Skip to content

Instantly share code, notes, and snippets.

@halfvector
Created May 4, 2015 17:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halfvector/e2b064b1c58d59e80547 to your computer and use it in GitHub Desktop.
Save halfvector/e2b064b1c58d59e80547 to your computer and use it in GitHub Desktop.
Git aliases
# a few git commands
alias gs='git status'
alias gp='git push'
alias gl='git log --graph --pretty=tformat:"%C(auto)%h%Creset - %s %Cgreen(%cr) %C(bold blue)<%an>%Creset %C(auto)%d%Creset" --abbrev-commit'
alias cdiff='cdiff -s -c always | less -rFX'
# recent log entries without a pager
alias glr='git --no-pager log -25 --graph --pretty=tformat:"%C(auto)%h%Creset - %s %Cgreen(%cr) %C(bold blue)<%an>%Creset %C(auto)%d%Creset" --abbrev-commit'
alias gs='git status -s'
alias gup='git pull --rebase'
alias gb='git branch -v -v'
alias gds='git diff --stat'
alias ga='git add . -A'
# pretty diffs (requires cdiff)
# unstagged && uncommitted
alias gd='echo "Showing unstagged and uncommitted changes:"; cdiff'
# stagged && uncommitted
alias gds='echo "Showing stagged but uncommitted changes:"; git diff -C -M --cached | cdiff'
# stagged && committed
alias gdc='echo "Showing committed changes:"; git diff origin..HEAD | cdiff'
# stagged || unstagged || committed || uncommitted
alias gdp='echo "Showing all unpushed changes:"; git diff -C -M HEAD~1 | cdiff'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment