Skip to content

Instantly share code, notes, and snippets.

@HungYuHei
Created September 9, 2011 15:41
Show Gist options
  • Save HungYuHei/1206553 to your computer and use it in GitHub Desktop.
Save HungYuHei/1206553 to your computer and use it in GitHub Desktop.
Useful gitconfig aliases
[alias]
st = status
rso = remote show origin
# e.g. git graphviz --first-parent master | dotty /dev/stdin
graphviz = "!f() { echo 'digraph git {' ; git log --pretty='format: %h -> { %p }' \"$@\" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' ; echo '}'; }; f"
# Pretty log
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
# Print out all commits whose hash starts with a given string
abbr = "!sh -c 'git rev-list --all | grep ^$1 | while read commit; do git --no-pager log -n1 --pretty=format:\"%H %ci %an %s%n\" $commit; done' -"
# Two little tweaks to diff
changes=diff --name-status -r
diffstat=diff --stat -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment