Skip to content

Instantly share code, notes, and snippets.

@adrianomitre
Created August 15, 2016 17:12
Show Gist options
  • Save adrianomitre/d4c38325b05fc7a4044c05ccbbfbbd7f to your computer and use it in GitHub Desktop.
Save adrianomitre/d4c38325b05fc7a4044c05ccbbfbbd7f to your computer and use it in GitHub Desktop.
My .gitconfig
[credential]
helper = cache --timeout=3600
[user]
name = Adriano Mitre
email = adriano.mitre@gmail.com
[core]
editor = subl --wait
[alias]
# one-line log
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
a = add
ap = add -p
c = commit --verbose
ca = commit -a --verbose
cm = commit -m
cam = commit -a -m
m = commit --amend --verbose
d = diff
ds = diff --stat
dc = diff --cached
s = status -s -b
co = checkout
cob = checkout -b
# 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/--'"
# list aliases
la = "!git config -l | grep alias | cut -c 7-"
# http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
le = log --oneline --decorate
filelog = log -u
fl = log -u
dl = "!git ll -1"
dlc = diff --cached HEAD^
dr = "!f() { git diff "$1"^.."$1"; }; f"
lc = "!f() { git ll "$1"^.."$1"; }; f"
diffr = "!f() { git diff "$1"^.."$1"; }; f"
f = "!git ls-files | grep -i"
grep = grep -Ii
gr = grep -Ii
gra = "!f() { A=$(pwd) && TOPLEVEL=$(git rev-parse --show-toplevel) && cd $TOPLEVEL && git grep --full-name -In $1 | xargs -I{} echo $TOPLEVEL/{} && cd $A; }; f"
done = "!f() { git branch | grep "$1" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f"
po = pull origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment