Ian McNally

Branching off another branch in git

January 15, 2019

A git workflow problem recently surfaced on my team. We branched (let’s call it branch B) off a branch (branch A) to keep working before A went into master.

To keep branch A & B up to date with master, we rebased master onto both A & B. This created conflicts between A & B when A went to master.

What would have worked a lot better was rebasing master only onto A, and rebase A onto B, like so:

An ideal workflow for branching off branches in git

If you follow the above flow, you’ll get a clean merge of B once A is on master.


Ian McNally

Hey, I'm Ian. I build websites and write about what I learn as I go. Follow me on Twitter.