Create a gist now

Instantly share code, notes, and snippets.

# 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