---
title: "Record the base commit when you send a patch | Proofline"
description: "Create patches for another engineer with git format-patch --base."
url: https://proofline.sh/learn/git-format-patch-base-commit/
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/)

# Record the base commit when you send a patch

Create patches for another engineer with git format-patch --base. The base commit is the fact a patch otherwise loses, and it decides whether a failed apply means a conflict or the wrong starting point.

Deployment failures The Proofline team November 24, 2026 3 min read

## A patch does not say where it belongs

A patch has context lines and blob IDs, and no commit. If it fails on the receiver's branch, three explanations fit: the branch moved and the change conflicts, the receiver is on an unrelated branch, or an earlier patch in the series is missing. `--base` separates them:

```
git format-patch --base=main -o out/ main..topic
tail -4 out/0001-*.patch
```

```
base-commit: d1d79457fd7e0e7d76d8a9208f2f0dbe28a6531b
--
2.43.0
```

The [`git format-patch` manual](https://git-scm.com/docs/git-format-patch) calls this base tree information. When the series rests on patches that are not public, it also lists each one's patch ID under `prerequisite-patch-id`.

## Read the three failures

The fixture changes line 2 of a three-line file, and the receiver's branch has changed line 3.

Plain `git am` fails because the context differs:

```
error: patch failed: a:1
error: a: patch does not apply
```

`git am --3way` falls back to a merge, because the receiver holds the original blob, and leaves ordinary conflict markers:

```
Falling back to patching base and 3-way merge...
CONFLICT (content): Merge conflict in a
```

In an unrelated repository, the same command cannot build a merge at all:

```
error: sha1 information is lacking or useless (a).
error: could not build fake ancestor
```

The last message means the receiver does not have the file version the patch was made from. That is a different problem from a conflict, and resolving text by hand will hide it. The manual for [`git am`](https://git-scm.com/docs/git-am) states the condition: the three-way merge needs the blobs the patch names to be available locally.

## Decide with the base

```
git cat-file -t BASE        # "commit" when this clone holds it
git merge-base --is-ancestor BASE HEAD; echo $?
```

| Result | Next decision |
| --- | --- |
| The object is missing | Fetch, or ask for a bundle. Do not edit the patch |
| Held, and an ancestor of `HEAD` (0) | The branch moved on. Apply with `--3way` and resolve |
| Held, and not an ancestor (1) | You may be on the wrong branch. Apply on the base first |

When the branch moved, applying on the base gives you the sender's tree exactly: `git switch -c check BASE && git am out/*.patch`. Run their test there. If it passes on the base and fails after a rebase, the rebase is the thing to look at.

## Limits

A shallow clone can fail the first check while the code is otherwise right. An ancestor check says nothing about whether the patch's behavior still holds on the newer code. A patch that applies cleanly can still be wrong, for example when a function it calls has changed meaning.

## Worked example

This example is fictional. Ben receives two patches and the second fails with `could not build fake ancestor`. The base line names a commit he does not have. Ana had branched from a colleague's unmerged work. She sends that commit's bundle first, and both patches apply on the base. The decision that remained was whether to wait for the colleague's branch, which is the question the bare patch had hidden.

A [bundle](/learn/git-bundle-branch-handoff/) carries the base itself. [Other handoffs](/learn/engineering-handoff-evidence/) are listed in the collection's first guide.

## 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

-   ### [Hand over a Git branch as a file when the receiver has no remote](/learn/git-bundle-branch-handoff/)
    
    Deployment failures The Proofline team November 24, 2026 3 min read
    
-   ### [Tell the next engineer which fixes are already on the release branch](/learn/backport-commits-already-picked/)
    
    Deployment failures The Proofline team November 24, 2026 2 min read
