Instantly share code, notes, and snippets.

Embed
What would you like to do?
Git aliases for .gitconfig
[alias]
# logs
l = log --pretty=format:"%C(Yellow)%H\\ %C(reset)%ad\\ %C(Green)%cr%C(reset)%x09\\ %Cred%d\\ %C(Cyan)%an:\\ %C(reset)%s" --decorate --date=format:%c
lg= log --graph --oneline --decorate --all
# add
a = add
au = add -u
ap = add -p
aa = add .
# commit
c = commit --verbose
ca = commit -a --verbose
cm = commit -m
cam = commit -a -m
m = commit --amend --verbose
# add & commit
ac = !git add -A && git commit -m
auca = !git add -u && git commit --amend
aum = !git add -u && git commit -m
# diff
d = diff
ds = diff --stat
dc = diff --cached
# push
p = push
po = push --set-upstream
# pull
pl = pull
gpla = pull --all
# status
s = status -s
# checkout
co = checkout
cob = checkout -b
# branch
bd = branch -d
bdf = branch -D
# stash
sh = stash
shs = stash save
shp = stash pop
shl = stash list
# list branches sorted by last modified
b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
# delete all merged branches
clb = "!git branch --merged | egrep -v '(^\\*|master|development)' | xargs git branch -d"
# list aliases
la = "!git config -l | grep alias | cut -c 7-"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment