Learning center

Why a Git note with test evidence does not reach your colleague

Git notes are not cloned or pushed by default, and an amended commit loses its note unless you configure otherwise. If the next engineer needs the evidence to decide, put it in a commit trailer or the pull request. Use notes only with an explicit push and fetch.

Where the note gets lost#

Ana records a QA result on a commit and pushes the branch:

git notes add -m "QA: passed on staging"
git push origin main

Ben clones. git log shows the commit and no note, and git notes show HEAD prints error: no note found for object 215b007.... Nothing in the clone says that a note exists elsewhere.

There are three separate gaps, each reproduced with Git 2.43:

StepDefaultWhat carries it
Ana pushes a branchNotes stay localgit push origin refs/notes/commits
Ben clones or fetchesNotes are not fetchedgit fetch origin 'refs/notes/*:refs/notes/*'
Ana amends the commitThe new commit has no notegit config notes.rewriteRef refs/notes/commits

Ben's fetch returned nothing until Ana ran her push. With the rewrite setting, an amended commit kept its note. After both, git notes show HEAD printed the text. Notes live under refs/notes/commits, outside the branches that a normal push and fetch cover. The git notes manual describes the ref and the rewrite settings.

The third gap also covers a squash merge: the server makes a new commit, and the note stays on the old one.

Choose where the evidence lives#

EvidencePlaceWhy
A fact that should stay with the change, such as who tested itCommit trailerIt is part of the commit, so every clone has it
A result that arrives after the commit is sharedPull request comment or checkAdding a trailer would change the commit
A large log or recordingA stored file, with its hash in one of the aboveNeither place is meant for files
Annotations your own tooling readsNotes, with the push and fetch configuredNothing is rewritten, and the team opts in

A trailer is one line at the end of the message, and Git can add it:

git interpret-trailers --trailer 'Tested-by: Ben <ben@example.com>' < message.txt

A trailer names a person and a claim. It carries no proof, so write what was tested in the body: the build, the command and the result.

What the receiver checks#

git ls-remote origin 'refs/notes/*' lists notes on the server without fetching them. Empty output means that this remote holds none under that prefix. It does not show that nobody wrote one, because an unpushed note exists only in its author's clone. If a message promises a note and the command prints nothing, ask for the push.

Worked example#

This example is fictional. A release engineer reads git log for the commits in a release and finds no test evidence on four of nine. The QA engineer had used notes on all nine. git ls-remote shows the notes ref, so it was pushed, and a fetch brings in five. The other four belonged to commits that were amended during review. The team moves the result into the pull request, where the squash merge cannot detach it, and the release engineer holds the four changes until the results are matched to the merged trees.

Matching a tested tree to a squash merge is the next step in that story. Handing over evidence lists the rest.

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading