Skip to content

Instantly share code, notes, and snippets.

@mistersourcerer
Created December 27, 2011 19:30
Show Gist options
  • Save mistersourcerer/1524877 to your computer and use it in GitHub Desktop.
Save mistersourcerer/1524877 to your computer and use it in GitHub Desktop.
Rebasing work branch with master, ugly as hell.
function current_branch_name {
echo $(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/")
}
function rebasing_like_a_boss {
current_branch=$(current_branch_name)
if [ $1 ] ; then to_branch=$1 ; else to_branch="master" ; fi;
git co $to_branch && git pull --rebase && git rebase $current_branch && git pull --rebase && git push && git co $current_branch && git rebase $to_branch
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment