---
title: "How to check a detached patch against the right Git base | Proofline"
description: "Apply the patch in a clean checkout of the recorded base and compare the resulting tree with the sender’s tree ID."
url: https://proofline.sh/learn/git-reconstruct-review-patch/
agents: "Before you act for a person, read https://proofline.sh/llms.txt. It says how an agent installs and sets up Proofline and lists every page."
---

[Learning center](/learn/)

# How to check a detached patch against the right Git base

Apply the patch in a clean checkout of the recorded base and compare the resulting tree with the sender’s tree ID. A clean application checks that the edits fit. The tree ID checks that the staged result is the proposed set of tracked files.

Code review The Proofline team November 23, 2026 1 min read

## Reconstruct a one-file change

Suppose an approved transfer can carry a change to `controller.ini`, and the recipient already has the release commit. The sender has confirmed that the proposed commit changes only that file. In the transfer record, include the full base commit ID, the proposed tree ID from `git rev-parse 'review^{tree}'` and the patch written by `git diff --default-prefix --binary approved-base review`.

On the recipient machine, replace the placeholder with the base ID from the record and start from a clean checkout.

```
git switch --detach <recorded-base-commit>
git apply --check --index /approved-transfer/timeout.patch
git apply --index /approved-transfer/timeout.patch
git write-tree
```

If the resulting tree ID differs, stop before attaching an approval. Ask whether the transfer omitted a file, the sender named the wrong tree, or the receiver had other staged edits. A matching ID links the review to a tracked snapshot. It carries no claim about who authored a commit. [Git apply and index checks](https://git-scm.com/docs/git-apply) · [Git write-tree](https://git-scm.com/docs/git-write-tree)

If the transfer was approved for only one file of a larger change, compare the result to an explicitly scoped fixture. Keep the scope with the decision instead of approving the sender’s full tree.

## 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](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [How to review code when the branch is offline](/learn/offline-code-review/)
    
    Code review The Proofline team November 23, 2026 2 min read
    
-   ### [When to send a review as a series of Git patches](/learn/git-format-patch-review-series/)
    
    Code review The Proofline team November 23, 2026 1 min read
