← Back to articles

Roger, please rebase your branch on the new release

This is a classic workflow. You’re coding on your favorite software and ready to ship your wonderful contribution to the develop branch.

You’ve already opened a Merge Request on your organization’s Git platform.

But then you’re asked to change the target of your branch.

Maybe your development must be shipped urgently on the soon-to-be-released version of the software.

The new_release branch was created a few days ago, derived from the develop branch.

I always struggle to remember and correctly use the Git command for this situation.

So instead of relying on man git-rebase or a random LLM, here’s a quick reminder:

git rebase --onto new_release develop mybranch

The value for --onto is the new branch you want to rebase on.

Then, as positional arguments, you must specify:

⚠️ Be prepared to handle conflicts if some changes on your branch are not directly applicable to new_release.

💡 If things go wrong, you can always use the lifesaver:

git rebase --abort

😉