If you are the only person working on a branch and you haven't made a PR for it yet (and that nobody reviewed or commented on the said PR), you can and should rebase your work. It keeps git history clean and makes resolving a merge conflict easier. But you will need to force push your work (assuming you already pushed it) because it basically rewrites your commit history.
For every other scenario, you would use merge. So if you are sharing your branch with someone, merging will retain you and your collaborator's commit history.
And if you are really not sure about any of this, merging is the safest way to go about it.
I'm a developer from Novi Sad with a passion for perfection. I'm a tireless seeker of knowledge and love the logic and
structure of coding. I always strive to write elegant and efficient code.
It depends.
If you are the only person working on a branch and you haven't made a PR for it yet (and that nobody reviewed or commented on the said PR), you can and should rebase your work. It keeps git history clean and makes resolving a merge conflict easier. But you will need to force push your work (assuming you already pushed it) because it basically rewrites your commit history.
For every other scenario, you would use merge. So if you are sharing your branch with someone, merging will retain you and your collaborator's commit history.
And if you are really not sure about any of this, merging is the safest way to go about it.
Thank you for this answer.