Skip to content

Instantly share code, notes, and snippets.

@nz
Created December 19, 2008 20:24
Show Gist options
  • Save nz/38105 to your computer and use it in GitHub Desktop.
Save nz/38105 to your computer and use it in GitHub Desktop.
# zsh shell functions for working in local git branches and rebasing appropriately
function rebase {
if [[ $1 == "" ]]; then master='master'; else master=$1; fi
branch=`git branch | grep \* | awk '{print $2}'` &&
git co $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 co $master && git merge $branch && git push origin master &&
git co $branch
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment