DEV Community

Discussion on: Rebase or merge

Collapse
 
maestromac profile image
Mac Siri

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.

Collapse
 
booorkoo profile image
Borko Arsovic 🚀

Thank you for this answer.