---
name: "notmuch-extract-patch"
section: "1"
platform: "linux"
package: "mailscripts"
version: "30-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/notmuch-extract-patch"
---

# notmuch-extract-patch(1)

extract a git patch series from notmuch

## NAME

notmuch-extract-patch - extract a git patch series from notmuch

## SYNOPSIS

**notmuch-extract-patch** \[***mbox-extract-patch****(1) options*\] \[*--*\] *QUERY*

## DESCRIPTION

**notmuch-extract-patch** is a wrapper around [**mbox-extract-patch**(1)](/mbox-extract-patch/1.md) to extract a series of git patches from your notmuch database.  It is designed to extract patches that were originally sent using [**git-send-email**(1)](/git-send-email/1.md).  It skips cover letters and replies/reviews in its output.

## EXAMPLE

```
    % git checkout -b test-feature
    % notmuch-extract-patch thread:000000000000265f | git am
```

## LIMITATIONS

We inherit limitations of [**mbox-extract-patch**(1)](/mbox-extract-patch/1.md).

**notmuch-extract-patch** can select patches to extract based on the reroll count (see -v in [**mbox-extract-patch**(1)](/mbox-extract-patch/1.md)), but otherwise typical usage assumes that there is only one patch series in a thread.

If this assumption is violated, you would need to construct a notmuch query that includes only the patches you want to extract, which somewhat defeats the purpose of having this script.

## SEE ALSO

[**notmuch**(1)](/notmuch/1.md), [**git-send-email**(1)](/git-send-email/1.md), [**mbox-extract-patch**(1)](/mbox-extract-patch/1.md)

Emacs functions 'notmuch-extract-thread-patches' and 'notmuch-extract-message-patches', provided by mailscripts.el

The piem project: \<https://docs.kyleam.com/piem/\>

## AUTHOR

Sean Whitton \<spwhitton@spwhitton.name\>

Rewrite, with additional features, of a script by Aurelien Aptel.
