memo

The git aliases I actually reuse

28 March 2026 · dev

Every so often I copy someone’s enormous list of git aliases, use three of them, and forget the rest. So this is the honest version: the ones still in my ~/.gitconfig a year later, because I type them without thinking.

The log I stare at all day

[alias]
    lg = log --graph --abbrev-commit --decorate \
         --format=format:'%C(bold blue)%h%C(reset) %C(dim white)%an%C(reset) %C(green)(%ar)%C(reset)%C(auto)%d%C(reset)%n  %s'

One-line-per-commit, coloured, with the branch/tag decorations. git lg is probably 80% of how I read history now.

The two “undo” ones

    unstage = reset HEAD --
    undo    = reset --soft HEAD~1

unstage <file> puts a file back without touching my edits. undo peels off the last commit but keeps the changes staged — exactly what I want after committing too early with a bad message.

Small quality-of-life

    st  = status -sb
    last = log -1 HEAD --stat
    br  = branch --sort=-committerdate
    please = push --force-with-lease

The last one matters: --force-with-lease refuses to clobber someone else’s work if the remote moved under me, which plain --force will happily do. Naming it please is the only reason I remember to reach for the safe version.

One config, not an alias, that I always set

git config --global rerere.enabled true

“Reuse recorded resolution.” It remembers how I resolved a conflict and replays it if the same one shows up again. On a long-lived branch that rebases often, it quietly saves a lot of repeated pain.

← Back to notes