git merge vs rebase

git merge vs rebase

Rebasing and merging are both designed to integrate changes from one branch into another branch but in different ways.

git merge vs rebase

If you have a feature branch´╝î

REBASE: you want to rebase the feature branch onto master branch, you move the feature branch’s base to masters’. If you have conflicts, it will present conflicts per commit, so you may end up resolve conflicts multiple times. It completely rewrites the history.

before rebase, you have
before git rebase

after rebase, you have
after git rebase

MERGE: you want to merge the feature branch onto master branch, you take the content of commits and integrate onto master branch. It creates a new commit for the merge, and you can resolve the conflicts and add a commit message. It preserves the history.

before merge, you have
before git merge

after merge, you have
after git merge

If you work in a large development team, I recommend to use merge, as it preserves the history and everyone is aware of what had happened in the past. If you have a fairly complicated history and you want to squash the commits, then rebase is a good option to do so.

If you are new to git and this book would help you with useful tips and techniques to work better with your development team.

I also design developer memes on Tshirts & stickers.



git merge vs rebase bottle git merge vs rebase mug git merge vs rebase tshirt

if you have the same taste of dev humour and enjoy the designs please support me at redbubble =)