Git Log Reported the Wrong Commit (and It Wasn't Git's Fault)

Nov 22, 2026

I keep notes on the websites I build, and every note that describes code records the commit it was written against. When I come back months later I can run git log <sha>..HEAD and see exactly what changed instead of guessing whether the note is stale.

That works right up until the SHA is wrong. In August I found three notes pointing at a commit one behind the real HEAD. Here's what I'd been running:

$ git log --oneline -1
f041d0c peony: stages 6-8 — clone and reset, homepage built, verified

Looks fine, right? Except HEAD was the merge commit right after it, b9caaf8 Merge origin/main into build/peony. Git log was quietly skipping it.

Why Git Log Wasn't Showing the Merge Commit

It wasn't git. I run my terminal commands through rtk, a proxy that trims command output so my AI coding agent isn't drowning in noise. The version I had (0.37) also filters merge commits out of git log. That's reasonable when you're skimming history and wrong when you're asking what commit you're on.

You can see the difference by bypassing the proxy:

$ git log --oneline -1
f041d0c peony: stages 6-8 — clone and reset, homepage built, verified

$ rtk proxy git log --oneline -1
b9caaf8 Merge origin/main into build/peony

The Fix: Use rev-parse

Git splits its commands into two groups. Porcelain commands like log and status are meant for humans, and their output can change with config, aliases, pagers, or in my case a proxy sitting in the middle. Plumbing commands like rev-parse are meant for scripts and return one plain answer.

To get the current commit:

$ git rev-parse --short HEAD
b9caaf8

Use it anywhere a script or a note needs the commit you're on. If you run any tool that rewrites or summarizes your terminal output, you're reading its version of the truth, so for anything you plan to record, ask git with plumbing.

Thanks for reading! I'd love to hear your thoughts - if you have something you want to share feel free to leave a comment or shoot me an email.

Comments

Leave a Comment