Skip to content

Instantly share code, notes, and snippets.

@nz
Created October 30, 2008 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nz/20926 to your computer and use it in GitHub Desktop.
Save nz/20926 to your computer and use it in GitHub Desktop.
Some shell functions I use to help me effortlessly do clean rebasing and pushing in git.
function rebase {
if [[ $1 == "" ]]; then master='master'; else master=$1; fi
branch=`git branch | grep \* | awk '{print $2}'` &&
git checkout $master && git pull && git rebase $master $branch
}
function push {
if [[ $1 == "" ]]; then master='master'; else master=$1; fi
branch=`git branch | grep \* | awk '{print $2}'` &&
rebase $master && git checkout $master && git merge $branch && git push &&
git checkout $branch
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment