Jayesh Bhoot's Ghost Town

Memorising branch order in git rebase

Posted on in

In a git rebase x command, is x being rebased on the current branch, or vice versa?

I mentally always read rebase as rebase on top of.

So, git rebase master reads as git, rebase on top of master, i.e., rebase the current branch on top of master.

But what about the alternate version of the command: git rebase master feat/x ?

Well, git always rebases the current branch.

So git rebase master feat/x is actually git checkout feat/x && git rebase master . So the reading git rebase on top of master still applies.

A bit clunky, but good enough for me.

Post author's photo Written by Jayesh Bhoot