Ramblings of an aging IT geek
← Ramblings of an aging IT geek
tooling

the handful of git aliases i actually use

A short, honest list of the git aliases that survived years in my config because they save real keystrokes, not the clever ones I added once and never typed again.

A terminal showing a git log graph

I have added dozens of git aliases over the years and quietly deleted most of them. The clever ones, the ones that chained six commands together to do something I needed once, never got typed a second time. The survivors are boring, and that is exactly why they earn their keep.

The one I use most is a readable log. The default git log is a wall of text; this gives me a graph I can actually scan.

[alias]
    lg = log --graph --abbrev-commit --decorate \
         --format=format:'%C(bold blue)%h%C(reset) %C(dim white)%s%C(reset) %C(green)(%cr)%C(reset) %C(bold yellow)%d%C(reset)'
    st = status -sb
    co = checkout
    amend = commit --amend --no-edit
    unstage = reset HEAD --
    last = show --stat HEAD

amend --no-edit is the quiet hero. Forgot a file, ran the tests, want it in the previous commit without reopening the editor: git amend and it is done. unstage exists purely because I can never remember that the way to undo git add is a reset, and I refuse to learn.

That is the whole list, more or less. Aliases that try to be clever become things you have to remember, which defeats the point. The good ones are just the commands you already type, with the friction filed off.