Last Updated: February 25, 2016
·
585
· lopsae

git rebase in plain english

I often forget the purpose of the different parameters that can be fed to the ruby rebase command. Here it s a handy translation to plain english and some notes:

This command:

git rebase --onto targetBranch fromBranch upToBranch

Reads in english as:

Grab commits from fromBranch until upToBranch and replay them on top of targetBranch.


Keep in mind that:

  • from targetBranch until upToBranch really means the range targetBranch..upToBranch, which is commits present in upToBranch excluding those present in fromBranch.
  • At the start of the command upToBranch will be checked out, and after the rebase it will be repointed to the last replayed commit.
  • If some changes are already present in targetBranch, for example due to cherry-pick's, those commits will be skipped in the replay.