Rebasing one branch onto another

Posted by Jason Noble on 07/29/2014 in git, github, rebase |

Ok, I’m tired of looking this up, so I’m going to document it here for future me.

We have a branching strategy:



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:
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

If this helps you, please let me know! 🙂

Source: git rebase –onto


  • Phil says:

    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

  • Jason Noble says:

    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.

Comments are closed. Would you like to contact the author directly?

Copyright © 2008-2022 Jason Noble's Technical Adventures All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.