Skip to content

Instantly share code, notes, and snippets.

@aalvarado
Created September 29, 2011 16:39
Show Gist options
  • Save aalvarado/1251200 to your computer and use it in GitHub Desktop.
Save aalvarado/1251200 to your computer and use it in GitHub Desktop.
bashscript for rebasing on upstream master.
#!/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