Skip to content

Instantly share code, notes, and snippets.

@cstrahan
Forked from geelen/Article.md
Created April 5, 2012 08:28
Show Gist options
  • Select an option

  • Save cstrahan/2309049 to your computer and use it in GitHub Desktop.

Select an option

Save cstrahan/2309049 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
@j3j3

j3j3 commented May 16, 2012

Copy link
Copy Markdown

What an amazing gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment