<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/Documentation/git-patch-id.adoc, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2026-02-17T18:49:51Z</updated>
<entry>
<title>doc: patch-id: see also git-cherry(1)</title>
<updated>2026-02-17T18:49:51Z</updated>
<author>
<name>Kristoffer Haugsbakk</name>
<email>code@khaugsbakk.name</email>
</author>
<published>2026-02-14T11:55:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ed84bc1c0da0c5a972459f639801bc7ec235084c'/>
<id>urn:sha1:ed84bc1c0da0c5a972459f639801bc7ec235084c</id>
<content type='text'>
git-cherry(1) links to this command. These two commands are similar and
we also mention it in the “Examples” section now. Let’s link to it.

Signed-off-by: Kristoffer Haugsbakk &lt;code@khaugsbakk.name&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>doc: patch-id: add script example</title>
<updated>2026-02-17T18:49:51Z</updated>
<author>
<name>Kristoffer Haugsbakk</name>
<email>code@khaugsbakk.name</email>
</author>
<published>2026-02-14T11:55:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=795d41db1304cdba06361916fa64f93c44678228'/>
<id>urn:sha1:795d41db1304cdba06361916fa64f93c44678228</id>
<content type='text'>
The utility and usability of git-patch-id(1) was discussed
relatively recently:[1]

    Using "git patch-id" is definitely in the "write a script for it"
    category. I don't think I've ever used it as-is from the command
    line as part of a one-liner. It's very much a command that is
    designed purely for scripting, the interface is just odd and baroque
    and doesn't really make sense for one-liners.

    The typical use of patch-id is to generate two *lists* of patch-ids,
    then sort them and use the patch-id as a key to find commits that
    look the same.

The command doc *could* use an example, and since it is a mapper command
it makes sense for that example to be a little script.

Mapping the commits of some branch to an upstream ref allows us to
demonstrate generating two lists, sorting them, joining them, and
finally discarding the patch ID lookup column with cut(1).

† 1: https://lore.kernel.org/workflows/CAHk-=wiN+8EUoik4UeAJ-HPSU7hczQP+8+_uP3vtAy_=YfJ9PQ@mail.gmail.com/

Inspired-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Kristoffer Haugsbakk &lt;code@khaugsbakk.name&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>doc: patch-id: emphasize multi-patch processing</title>
<updated>2026-02-17T18:49:51Z</updated>
<author>
<name>Kristoffer Haugsbakk</name>
<email>code@khaugsbakk.name</email>
</author>
<published>2026-02-14T11:55:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bfd125f64f86e78894d67c9eafdbae38779484bc'/>
<id>urn:sha1:bfd125f64f86e78894d67c9eafdbae38779484bc</id>
<content type='text'>
Emphasize that you can pass multiple patches or diffs to this command.

git-patch-id(1) is an efficient pID–commit mapper, able to map
thousands of commits in seconds. But discussions on the command
seem to typically[1] use the standard loop-over-rev-list-and-
shell-out pattern:

    for commit in rev-list:
        prepare a diff from commit | git patch-id

This is unnecessary; we can bulk-process the patches:

    git rev-list --no-merges &lt;ref&gt; |
         git diff-tree --patch --stdin |
         git patch-id --stable

The first version (translated to shell) takes a little over nine
minutes for a commit history of about 78K commits.[2] The other one,
by contrast, takes slightly less than a minute.

Also drop “the” from “standard input”.

† 1: https://stackoverflow.com/a/19758159
† 2: This is `master` of this repository on 2025-10-02

Signed-off-by: Kristoffer Haugsbakk &lt;code@khaugsbakk.name&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>doc: patch-id: --verbatim locks in --stable</title>
<updated>2026-01-09T14:08:37Z</updated>
<author>
<name>Kristoffer Haugsbakk</name>
<email>code@khaugsbakk.name</email>
</author>
<published>2026-01-08T06:28:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3f051fc9c9f9e719ad0e37b66737b466b82d17b3'/>
<id>urn:sha1:3f051fc9c9f9e719ad0e37b66737b466b82d17b3</id>
<content type='text'>
The default `--unstable` is a legacy format that predates `--stable`.
That’s why 2871f4d4 (builtin: patch-id: add --verbatim as a command mode,
2022-10-24) made `--verbatim` lock in[1] `--stable`:

    Users of --unstable mainly care about compatibility with old git
    versions, which unstripping the whitespace would break. Thus there
    isn't a usecase for the combination of --verbatim and --unstable,
    and we don't expose this so as to not add maintainence burden.

† 1: imply `--stable`, disallow `--unstable`

Signed-off-by: Kristoffer Haugsbakk &lt;code@khaugsbakk.name&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>doc: patch-id: spell out the git-diff-tree(1) form</title>
<updated>2026-01-09T14:07:22Z</updated>
<author>
<name>Kristoffer Haugsbakk</name>
<email>code@khaugsbakk.name</email>
</author>
<published>2026-01-08T06:28:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=89d4f3af16a95fe1b6abe8c9f43fb7fb6826dadf'/>
<id>urn:sha1:89d4f3af16a95fe1b6abe8c9f43fb7fb6826dadf</id>
<content type='text'>
You specifically need `--patch` since the default output is a raw diff.

Signed-off-by: Kristoffer Haugsbakk &lt;code@khaugsbakk.name&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>doc: patch-id: use definite article for the result</title>
<updated>2026-01-09T14:07:21Z</updated>
<author>
<name>Kristoffer Haugsbakk</name>
<email>code@khaugsbakk.name</email>
</author>
<published>2026-01-08T06:28:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f671f5a83b78643964bdfb75eb0aab54d23e25e9'/>
<id>urn:sha1:f671f5a83b78643964bdfb75eb0aab54d23e25e9</id>
<content type='text'>
Signed-off-by: Kristoffer Haugsbakk &lt;code@khaugsbakk.name&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>patch-id: use “patch ID” throughout</title>
<updated>2026-01-09T14:07:21Z</updated>
<author>
<name>Kristoffer Haugsbakk</name>
<email>code@khaugsbakk.name</email>
</author>
<published>2026-01-08T06:28:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=285659cc983a60f89a60f96cff7397375766f3f8'/>
<id>urn:sha1:285659cc983a60f89a60f96cff7397375766f3f8</id>
<content type='text'>
The “Description” section decided to introduce and use the term “patch
ID” for the ID value itself.  Let’s use the same term on the options as
well.

Also make to sure to use bare “ID” instead of “id”.

Signed-off-by: Kristoffer Haugsbakk &lt;code@khaugsbakk.name&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>doc: patch-id: capitalize Git version</title>
<updated>2026-01-09T14:07:21Z</updated>
<author>
<name>Kristoffer Haugsbakk</name>
<email>code@khaugsbakk.name</email>
</author>
<published>2026-01-08T06:28:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=92a61fe44dad03360141051180ace4aa39984abc'/>
<id>urn:sha1:92a61fe44dad03360141051180ace4aa39984abc</id>
<content type='text'>
Git versions are always capitalized.

Signed-off-by: Kristoffer Haugsbakk &lt;code@khaugsbakk.name&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>doc: patch-id: don’t use semicolon between bullet points</title>
<updated>2026-01-09T14:07:20Z</updated>
<author>
<name>Kristoffer Haugsbakk</name>
<email>code@khaugsbakk.name</email>
</author>
<published>2026-01-08T06:28:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3d61c1988b5d9468113dbe250e99eaabd3832090'/>
<id>urn:sha1:3d61c1988b5d9468113dbe250e99eaabd3832090</id>
<content type='text'>
These bullet points are full-fledged paragraphs with sentences.  It’s
best to restrict semicolon-termination to the case when the bullet list
amounts to a list of items.[1]

† 1: Like “List: ... • first; ... • second; and ... • third.”

Signed-off-by: Kristoffer Haugsbakk &lt;code@khaugsbakk.name&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>doc: patch-id: convert to the modern synopsis style</title>
<updated>2025-10-13T15:53:13Z</updated>
<author>
<name>Kristoffer Haugsbakk</name>
<email>code@khaugsbakk.name</email>
</author>
<published>2025-10-13T15:42:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8f487db07aa16e026fde0e3d11e4fbf31ab15636'/>
<id>urn:sha1:8f487db07aa16e026fde0e3d11e4fbf31ab15636</id>
<content type='text'>
Convert this command documentation to the modern synopsis style based on
similar work.[1] Concretely:

• Change the Synopsis section from `verse` to a `synopsis` block which
  will automatically apply the correct formatting to various elements
  (although this Synopsis is very simple)
• Use backticks (`) for code-like things which will also use the correct
  formatting for interior placeholders (`&lt;orderfile&gt;`)
• Use inline-verbatim on options listing

† 1: E.g.,
     • 026f2e3b (doc: convert git-log to new documentation format,
       2025-07-07)
     • b983aaab (doc: convert git-switch manpage to new synopsis style,
       2025-05-25)
     • 16543967 (doc: convert git-mergetool manpage to new synopsis
       style, 2025-05-25)

Signed-off-by: Kristoffer Haugsbakk &lt;code@khaugsbakk.name&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
