# git format-patch --cover-letter: Usage, Options & Common CI Errors

> git format-patch --cover-letter adds a 0000 summary patch to a series. Reference for -o, --subject-prefix, and the placeholder-subject and empty-range errors.

Source: https://latchkey.dev/learn/command-reference/git-format-patch-cover-letter  
Updated: 2026-06-25

git format-patch --cover-letter prepends a 0000 summary patch that introduces the whole series.

When sending more than one patch, a cover letter (0000-cover-letter.patch) gives reviewers the high-level story before the individual commits. It is the standard for multi-patch submissions.

## What it does

git format-patch --cover-letter generates the usual numbered patch files plus an extra 0000 cover letter containing the series shortlog and diffstat, ready for editing and sending.

## Common usage

```Terminal
git format-patch --cover-letter -3 -o out/
git format-patch --cover-letter origin/main
git format-patch --cover-letter --subject-prefix="PATCH v2" main..feature
# then edit out/0000-cover-letter.patch before sending
```

## Options

| Flag | What it does |
| --- | --- |
| --cover-letter | Emit a 0000 summary patch |
| -o <dir> | Write patches to a directory |
| --subject-prefix=<text> | Override the [PATCH] prefix |
| -v <n> / --reroll-count | Mark the series as version n |
| --thread | Add threading headers |

## Common errors in CI

A frequent slip is sending the cover letter with its placeholder subject still set to "*** SUBJECT HERE ***" - edit it before send-email. An empty or reversed range (e.g. feature..main) produces no patches; verify the range yields commits with git rev-list --count first.

## Using this in CI

CI checkouts are shallow and detached by default, which changes the answer this command gives you. Commands that read history, branch names, or tags need the checkout configured for it.

```.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0   # history, tags, and git describe all need this

- run: |
    git rev-parse --is-shallow-repository   # expect false
    git rev-parse --abbrev-ref HEAD          # prints HEAD when detached
```

> `git rev-parse --abbrev-ref HEAD` returns the literal string `HEAD` on a detached checkout rather than a branch name. On GitHub Actions read `github.ref_name` instead; the git command cannot know what it was checked out for.

## FAQ

### git format-patch --cover-letter: Usage, Options & Common CI Errors?

When sending more than one patch, a cover letter (0000-cover-letter.patch) gives reviewers the high-level story before the individual commits. It is the standard for multi-patch submissions.

### What it does?

git format-patch --cover-letter generates the usual numbered patch files plus an extra 0000 cover letter containing the series shortlog and diffstat, ready for editing and sending.

### Common errors in CI?

A frequent slip is sending the cover letter with its placeholder subject still set to "* SUBJECT HERE *" - edit it before send-email. An empty or reversed range (e.g. feature..main) produces no patches; verify the range yields commits with git rev-list --count first.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
