Last active
October 6, 2015 18:13
-
-
Save aubricus/b4099d1e62c5cfbcdc77 to your computer and use it in GitHub Desktop.
Rebase a local branch who's upstream has been rebased.
This file contains hidden or 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
# Thanks to: | |
# http://stackoverflow.com/a/20423029 (recover rebased upstream) | |
# http://stackoverflow.com/a/11868440 (get current branch name) | |
# Note: | |
# Be sure to checkout the branch you wish to re-sync / recover | |
# change this to desired upstream | |
upstream_branch=upstream/environment-detail | |
# just stores current branch name for later | |
current_branch=$(git symbolic-ref --short HEAD) | |
# finds common commit between upstream and current branch | |
fork_point=$(git merge-base --fork-point $upstream_branch $current_branch) | |
# perform rebase | |
git rebase --onto $upstream_branch $fork_point $current_branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment