Skip to content

Instantly share code, notes, and snippets.

@dpurrington
Last active January 31, 2017 13:57
Show Gist options
  • Save dpurrington/7d1e4b7080b888b542bd1b52133f52d0 to your computer and use it in GitHub Desktop.
Save dpurrington/7d1e4b7080b888b542bd1b52133f52d0 to your computer and use it in GitHub Desktop.
[alias]
find-tag = "!f() { git show-ref --tags -d | grep $1 | cut -d' ' -f2 | cut -d'^' -f1 | cut -d'/' -f3 ; }; f"
# one-line log
ls = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
#pretty log with files
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
#pretty log with age
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
le = log --oneline --decorate
#show log from a single commit (sha)
lc = "!f() { git ll "$1"^.."$1"; }; f"
a = add
ap = add -p
c = commit --verbose
ca = commit -a --verbose
cm = commit -m
cam = commit -a -m
m = commit --amend --verbose
#add all and commit
ac = !git add . && git commit -am
#show modified files in last commit
dl = "!git ll -1"
#diff last commit
dlc = diff --cached HEAD^
d = diff
ds = diff --stat
dc = diff --cached
#diff a commit (sha)
dr = "!f() { git diff "$1"^.."$1"; }; f"
#find a file
f = "!git ls-files | grep -i"
s = status -s
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-"
clean-merged = !git branch --merged | grep -v \"\\*\" | xargs -n 1 git branch -d
[filter "lfs"]
smudge = git-lfs smudge -- %f
required = true
clean = git-lfs clean -- %f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment