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

the handful of git aliases i'd miss

A short, opinionated set of git aliases I actually use every day, and why the ones that look clever are usually the ones I delete.

A keyboard glowing in front of a terminal

I've watched people copy a two-hundred-line .gitconfig from a gist, use four of the aliases, and forget the rest exist. I've been that person. So this isn't a mega-list. It's the small set that has survived years of me trimming the ones I never typed.

The rule I settled on: an alias earns its place if I'd reach for it without thinking. If I have to remember it's there, it's noise, and noise in your config is just a slower way of not having the command.

Here's the lot, from [alias] in my .gitconfig:

[alias]
    st = status -sb
    co = checkout
    br = branch
    lg = log --oneline --graph --decorate -20
    last = log -1 HEAD --stat
    unstage = reset HEAD --
    amend = commit --amend --no-edit
    wip = !git add -A && git commit -m wip --no-verify

st is the one I type most, easily. status -sb gives the short format with the branch line on top, which is all I want ninety per cent of the time. The full git status essay is for when something's actually gone wrong.

A short status output and a graph log

lg is the only one with any flourish, and even then I cap it at the last twenty commits because an unbounded graph log is just a way to lose the thread on a busy repo. If I want the whole history I'll say so.

unstage is pure ergonomics. git reset HEAD -- is not hard, but git unstage somefile reads like what I mean, and the gap between intent and the command is exactly what an alias should close.

amend with --no-edit is for the constant small case: you committed, you immediately spotted the typo or the missing file, you fix it, and you fold it into the last commit without reopening the editor to retype the same message. Used carefully on commits you haven't pushed, it's harmless and saves a fiddly dance every single day.

The slightly cheeky one is wip. It's a shell alias (note the leading !), it stages everything and commits with a throwaway message, and crucially it passes --no-verify to skip the hooks. That last part is deliberate and also the reason to be careful. A wip commit is a savepoint, not a contribution: I make them when I want to switch branches mid-thought without stashing, and I always squash or reset them out before anything goes near a pull request. If you'd be embarrassed to see "wip" in the history, treat it accordingly.

What's not in here is as deliberate as what is. I don't alias push or pull, because the few characters saved aren't worth muscle-memorising a command that occasionally needs a flag I'd then have to un-learn the alias to reach. And I deleted every clever one-liner that pretty-printed something I look at twice a year. They were fun to write and I never typed them.

If you take one thing: start with an empty alias block and only add a line the third time you wish it existed. The config that earns its keep is the one you grew, not the one you inherited.