Rebasing one branch onto another
Ok, I’m tired of looking this up, so I’m going to document it here for future me.
We have a branching strategy:
maint-2014.04.04
maint-2014.04.18
…
master
When I create a new branch based off master, I name it 1234567890_some_short_summary_master.
Later I determine it should have been based off maint-2014.04.04.
Here’s the process:
[code]
git checkout 1234567890_some_short_summary_master
git fetch upstream
git rebase upstream/master
git rebase –onto upstream/maint-2014.04.04 upstream/master 1234567890_some_short_summary_master
git branch -m 1234567890_some_short_summary_master 1234567890_some_short_summary_0404
[/code]
If this helps you, please let me know! 🙂
Source: git rebase –onto
2 Comments
Couldn’t you reduce a step by removing the git rebase upstream/master on line 3? I don’t see why you would rebase onto master if you want your branch to be based off of upstream/maint-2014.04.04
Possibly. The reason I rebase off upstream/master is so that I have a known point to rebase off of for the command in line 4.