Skip to content

Instantly share code, notes, and snippets.

@mwitek
Created March 25, 2012 21:49
Show Gist options
  • Save mwitek/2200122 to your computer and use it in GitHub Desktop.
Save mwitek/2200122 to your computer and use it in GitHub Desktop.
Git push origin [branch_name] alias command
## Copy code below into .bash_profile
#alias commands for git push origin [your current branch] & git pull origin [your current branch]
alias gpush='git push origin $(git_current_branch)'
alias gpull='git pull origin $(git_current_branch)'
#function that retrieves the current branch name
git_current_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment