Thursday, January 21, 2010

Git aliases

I found this very useful in day-to-day git work.
[alias]
    a = add

    s = status --short
    ss = status

    b = branch -a
    ba = branch -a -vv
    bs = !git-branch-status
    bsi = !git-branch-status -i

    c = commit
    cm = commit -m

    co = checkout

    d = diff --color
    ds = diff --color --stat
    dsp = diff --color --stat -p
    # files changed between commits
    dn = diff --color --name-only

    l = log --color --decorate
    ls = log --color --stat --decorate
    ln = log --name-status --color
    lsp = log --color --stat -p --decorate
    lg = log --graph '--pretty=tformat:%Cblue%h%Creset %Cgreen%ar%Creset %Cblue%d%Creset %s'
    lga = log --graph '--pretty=tformat:%Cblue%h%Creset %Cgreen%ar%Creset %Cblue%d%Creset %s' --all
    l10 = log --graph '--pretty=tformat:%Cblue%h%Creset %Cgreen%ar%Creset %Cblue%d%Creset %s' --all -10
    # for complicated branches
    lsd = log --graph '--pretty=tformat:%Cblue%h%Creset %Cgreen%ar%Creset %Cblue%d%Creset %s' --all --simplify-by-decoration

    ru = remote update
    sb = show-branch --sha1-name

    ls-del = ls-files -d
    ls-mod = ls-files -m # including remote files
    ls-new = ls-files --exclude-standard -o
    ls-ign = ls-files --exclude-standard -o -i

Update (2012-11-11)
https://gist.github.com/4056358