Created
August 21, 2012 15:01
-
-
Save nicwolff/3416281 to your computer and use it in GitHub Desktop.
Git alias to rebase master branch on origin and rebase current branch on it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
up = ! git stash && git checkout master && (git pull --rebase | grep 'up to date' && git checkout '@{-1}' || git checkout '@{-2}' ) && git rebase master && git stash pop |
Added "git stash" and "git stash apply"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The tricky part is that if the pull --rebase of master on origin updates master with any commits, then the "previous branch" in reflog is "master" and we have to go back 2 branches.