Skip to content

Instantly share code, notes, and snippets.

@hohonuuli
Last active August 20, 2018 19:07
Show Gist options
  • Save hohonuuli/ff35e32284b95544d9a0 to your computer and use it in GitHub Desktop.
Save hohonuuli/ff35e32284b95544d9a0 to your computer and use it in GitHub Desktop.
Aliases for .gitconfig
[alias]
#Show all branches
branches = branch -a
# Show conflicted files after a merge
conflicted = grep --name-only --full-name '<<<<<<< HEAD'
# Grep - search for occurence of term in all git managed files
gr = grep -Ii
# Linearlized change history
ls = log --pretty=format:%C(red)%h%Cgreen%d\\ %Creset%s%Cblue\\ <%cn> --decorate
# Linearlized change history in long format
ll = log --pretty=format:%C(red)%h%Cgreen%d\\ %Creset%s%Cblue\\ <%cn> --decorate --numstat
# List ignored files
ls-ignored = ls-files --exclude-standard --ignored --others
# Short History (tags, last 2 commits and related branches)
sh = log --graph --all --simplify-by-decoration --decorate --pretty=format:'%Cred%h%Creset - %C(yellow)%cd%Creset -%C(green)%d%Creset %s %C(bold blue)<%an>%Creset' --date=short
# Short History (tags, last 2 commits and related branches) using relative date
shr = log --graph --all --simplify-by-decoration --decorate --pretty=format:'%Cred%h%Creset - %C(yellow)%cd%Creset -%C(green)%d%Creset %s %C(bold blue)<%an>%Creset' --date=relative
# Full history graph
fh = log --graph --all --pretty=format:'%Cred%h%Creset - %C(yellow)%cd%Creset -%C(green)%d%Creset %s %C(bold blue)<%an>%Creset' --abbrev-commit --date=short
# Full History with relative date
fhr = log --graph --all --pretty=format:'%Cred%h%Creset - %C(yellow)%cd%Creset -%C(green)%d%Creset %s %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
# Show info about last commit
last = log -1 HEAD --stat --date=iso
# Show last tag
lasttag = describe --tags --abbrev=0
# Show diffs of recent changes
news = log --word-diff=color -p HEAD@{1}..HEAD@{0}
# Show the remote origin
origin = remote show origin
# Show all remotes
origins = remote -v
# Show root of current git repo
root = rev-parse --show-toplevel
# Short version of status. Output looks Similar to svn status
st = status --short --branch
# Do diff using a word diff instead of a line diff
wd = diff --word-diff
# Show author full name (e.g. git author brian)
whois = !sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\
\" --author=\"$1\"' -
# Show a release log
releasenotes = log --pretty=format:'- %s%n%b' --since='$(git show -s --format=%ad `git rev-list --tags --max-count=1`)'
springcleaning = for-each-ref --sort=-committerdate --format='%(refname:short) %(committerdate:short)'
# List all aliases
alias = ! git config --get-regexp ^alias\\. | sed -e s/^alias\\.// -e s/\\ /\\ =\\ /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment