Git Aliases

I recently gave a presentation for the Bozeman Montana Programmers group on some Git Tips and Tricks that I find useful.

git-config

For part of the presentation I went over some useful Git aliases that I put together. Here’s a list of my favorite aliases.

st = status
a = !git add . && git status
ci = commit --verbose

l = !git --no-pager log -n 10 --format='%C(cyan)%h%C(reset) %ar %C(blue)%an%C(reset) %C(yellow)%s%C(reset)' ; last 10 log items
lt = !git --no-pager log -n 10 --date=local --format='%C(cyan)%h%C(reset) %aD %C(blue)%an%C(reset) %C(yellow)%s%C(reset)' ; last 10 log items
cl = log --format='%h %cr %cn %Cgreen%s%Creset' --name-status ; quick log with file list and pager
flog = log -u ; shows log with file changes inline with pager
unpushed = !git l @{u}..

unstage = reset HEAD
uncommit = reset --soft HEAD^
di = diff
dc = diff --cached
ds = !git --no-pager diff --stat=160,120

fix = "!$EDITOR `git diff --name-only --diff-filter=U`"
fadd = "!git add `git diff --name-only --diff-filter=U`"

dh1 = diff HEAD~1

stl = !git --no-pager stash list --format='%C(cyan)%gd%C(reset) %C(yellow)%cr%C(reset) %cn'
stt = !git --no-pager stash show stash@{0}
std = stash show -p stash@{0}