You are currently viewing When do you use git rebase instead of git merge?

When do you use git rebase instead of git merge?

  • Post category:Git
  • Post comments:1 Comment

When is it recommended to use git rebase vs. git merge?
Do I still need to merge after a successful rebase?

Short Version

  • Merge takes all the changes in one branch and merge them into another branch in one commit.
  • Rebase says I want the point at which I branched to move to a new starting point

So when do you use either one?


Let’s say you have created a branch for the purpose of developing a single feature. When you want to bring those changes back to master, you probably want merge (you don’t care about maintaining all of the interim commits).

A second scenario would be if you started doing some development and then another developer made an unrelated change. You probably want to pull and then rebase to base your changes from the current version from the repo.