Member-only story
Git Rebase For Nested Branches
If rebasing becomes tedious, you might be doing it wrong
Understanding Git rebase took me some time. Just as I was building confidence in my skills, I discovered that, sometimes, some rebases felt off. I had painful conflicts. Some of them were not even supposed to happen!
Worse, I could not tell why those rebases, in particular. The chances are, I was doing something wrong.
The Nested Branch Issue
First, I recommend checking out my previous article to get more familiar with Git rebase:
I’ll take this opportunity to extend that article’s example. Assuming that my next task requires awesome_branch
’s content, I’ll need to create a branch from it. I called it nested_branch
.

I’m aiming at merging both awesome_branch
and nested_branch
into develop
. Before I can do so, my other branches have probably moved on. I’m likely to face one of the following situations:
develop
has evolved, making bothawesome_branch
andnested_branch
behinddevelop
.- Something comes up on
awesome_branch
and new commits are needed.


(1) requires me to rebase awesome_branch
on develop
before going any further. Same with (2) between nested_branch
and awesome_branch
.
Both situations won’t be an issue to merge awesome_branch
eventually. Let’s follow up with (1) after merging awesome_branch
:
