Skip to content

Instantly share code, notes, and snippets.

@geelen
Created September 22, 2010 00:49
Show Gist options
  • Save geelen/590895 to your computer and use it in GitHub Desktop.
Save geelen/590895 to your computer and use it in GitHub Desktop.

Idiot-Proof Git Aliases

function git_current_branch() {
git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///'
}
alias gpthis='git push origin HEAD:$(git_current_branch)'
alias grb='git rebase -p'
alias gup='git fetch origin && grb origin/$(git_current_branch)'
alias gm='git merge --no-ff'
function git_parse_branch
sh -c 'git symbolic-ref HEAD 2> /dev/null' | sed -e 's/refs\/heads\///'
end
function gm
git merge --no-ff $argv;
end
function gpthis
git push origin HEAD:(git_parse_branch) $argv
end
function gup
git fetch origin; and git rebase -p origin/(git_parse_branch) $argv;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment