Do you know to Rebase not Merge?
  v3.0 Posted at 16/02/2016 7:50 AM by Tiago Araujo

When you merge a branch you end up with messy merge commits.

Rebasing might take a bit to get your head around, but you get a much cleaner project history.

  • it eliminates the unnecessary merge commits required by git merge
  • rebasing also results in a perfectly linear project history - you can follow the tip of feature all the way to the beginning of the project without any forks.

This makes it easier to navigate your project with commands like git log, git bisect, and gitk.

Figure: When merging: a messy merge commit is created any time you need to incorporate upstream changes from the master branch
Figure: Git Rebase moves your new commits to the end of the master branch. This ensure that you don't end up with messy merge commits and you have a clean linear project history

Warning: If you don’t follow the Golden Rule of Rebasing, you could end up in a ​world of pain.

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address:


    Note: Social Media login for Yotpo is not working in IE or Safari, please use Chrome. We are waiting for Yotpo to fix it.