29 May 2026

Git Notes

Git can attach metadata to a commit without rewriting it. git notes lets you bolt extra context onto history after the fact — review links, deploy info, context that didn't fit the message — without touching the SHA.

Here's a Git feature almost nobody uses: git notes. It lets you attach extra metadata to a commit after it's been made — without rewriting history or changing the SHA.

The problem it solves

You write a commit message, push it, and only later realise you wanted to record something — a review link, a deploy timestamp, why a weird workaround exists. Amending means a new SHA and a force push. Notes sidestep that entirely. The commit stays exactly as it was; the note rides alongside it.

The basics

git notes add -m "Reviewed by Sam, deployed 2026-05-29" HEAD
git notes show HEAD          # read it back
git log                      # notes show under the commit automatically

Edit or remove them just as easily:

git notes edit HEAD
git notes remove HEAD

Where it earns its keep

  • CI/CD metadata — stamp a commit with the build number or deploy URL it shipped in.
  • Review context — link the PR, record who signed off, without polluting the message.
  • After-the-fact explanation — the "why" you only understood three weeks later.

The catch you need to know

Notes don't push or pull by default. They live in their own ref, refs/notes/commits, and Git leaves them on your machine unless you tell it otherwise:

git push origin refs/notes/commits
git fetch origin refs/notes/*:refs/notes/*

That's the one gotcha that bites people — they add notes, never see them on the remote, and assume the feature is broken.

You can also keep separate categories with --ref:

git notes --ref=deploys add -m "shipped in v2.3.1" HEAD
git log --notes=deploys

It's not something I reach for daily. But when you want to annotate history without rewriting it, nothing else does the job as cleanly.