Same files, different commit#
In the fixture, QA tests the head of feat. The branch is squash-merged onto a main that has not moved.
| Commit | Tree | |
|---|---|---|
Tested, feat | 8dac2d4 | 4fdcd9b |
Merged, main | 89f35f1 | 4fdcd9b |
The trees match, so every tracked file has the same content, name and mode. git merge-base --is-ancestor feat main exits 1, because a squash leaves no ancestry. A script that looks for the tested commit in main would report that QA's build never shipped.
Then main gains an unrelated file b before the squash. The merged tree becomes 9741da4, and the difference is one file:
$ git diff --stat feat main
b | 1 +
Run with Git 2.43.
Decide from the two trees#
git rev-parse TESTED^{tree} MERGED^{tree}
git diff --stat TESTED MERGED
| Result | Decision |
|---|---|
| Trees equal | The result applies to the merged source. Check the build inputs below |
| Trees differ, and the diff is outside what the test exercised | Someone who knows the dependency between the two decides, and writes down why |
| Trees differ inside it | Test again on the merged commit |
| The tested commit cannot be found | The result has no known subject. Test again |
The last row happens after a force push. If the pull request still records the head, its commit can usually be fetched by ID from the server. Keep the tree ID in the QA note and you can compare even when the commit object is gone.
Equal trees are not equal builds#
The tree covers tracked files. Two builds of one tree can still differ in:
- dependencies, when the install does not use the lockfile;
- the base image, when it is named by a tag that moved;
- build arguments, feature flags and environment variables;
- generated files that are not tracked;
- submodules, whose tree entry is a commit ID, and LFS files, which are pointers.
A record of the artifact's digest closes most of that gap. If QA tested digest X and digest X was deployed, the source question is moot, and the remaining differences are in configuration and data.
What to write in the handoff#
Tested commit
8dac2d4, tree4fdcd9b, image digestsha256:…, staging, 2026-11-24 09:10 UTC. Export with 0, 1 and 5,000 rows: pass. Not tested: export while a deploy is running.
The tree is the field that survives a squash or a rebase onto the same base.
Worked example#
This example is fictional. A release engineer finds QA notes for nine changes. For six, the trees match. Two differ by documentation files. The ninth differs by a change to the currency formatter, which merged an hour before the export change that QA had tested. The export calls that formatter. The decision is one rerun of the export cases on main, and the other eight changes wait for nothing.
When the evidence was written as a Git note, it may not have travelled. Return to handing over evidence.