Created
September 29, 2011 16:39
-
-
Save aalvarado/1251200 to your computer and use it in GitHub Desktop.
bashscript for rebasing on upstream master.
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
#!/bin/sh | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
current_branch=$(parse_git_branch) | |
if [[ -n "$current_branch" ]]; then | |
git fetch -v upstream | |
git checkout master | |
git rebase -v upstream/master | |
git checkout $current_branch | |
git rebase master | |
else | |
echo "Not currently in a repository" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment