1GIT-PATCH-ID(1) Git Manual GIT-PATCH-ID(1)
2
3
4
6 git-patch-id - Compute unique ID for a patch
7
9 git patch-id [--stable | --unstable | --verbatim]
10
12 Read a patch from the standard input and compute the patch ID for it.
13
14 A "patch ID" is nothing but a sum of SHA-1 of the file diffs associated
15 with a patch, with line numbers ignored. As such, it’s "reasonably
16 stable", but at the same time also reasonably unique, i.e., two patches
17 that have the same "patch ID" are almost guaranteed to be the same
18 thing.
19
20 The main usecase for this command is to look for likely duplicate
21 commits.
22
23 When dealing with git diff-tree output, it takes advantage of the fact
24 that the patch is prefixed with the object name of the commit, and
25 outputs two 40-byte hexadecimal strings. The first string is the patch
26 ID, and the second string is the commit ID. This can be used to make a
27 mapping from patch ID to commit ID.
28
30 --verbatim
31 Calculate the patch-id of the input as it is given, do not strip
32 any whitespace.
33
34 This is the default if patchid.verbatim is true.
35
36 --stable
37 Use a "stable" sum of hashes as the patch ID. With this option:
38
39 • Reordering file diffs that make up a patch does not affect the
40 ID. In particular, two patches produced by comparing the same
41 two trees with two different settings for "-O<orderfile>"
42 result in the same patch ID signature, thereby allowing the
43 computed result to be used as a key to index some
44 meta-information about the change between the two trees;
45
46 • Result is different from the value produced by git 1.9 and
47 older or produced when an "unstable" hash (see --unstable
48 below) is configured - even when used on a diff output taken
49 without any use of "-O<orderfile>", thereby making existing
50 databases storing such "unstable" or historical patch-ids
51 unusable.
52
53 • All whitespace within the patch is ignored and does not affect
54 the id.
55
56 This is the default if patchid.stable is set to true.
57
58 --unstable
59 Use an "unstable" hash as the patch ID. With this option, the
60 result produced is compatible with the patch-id value produced by
61 git 1.9 and older and whitespace is ignored. Users with
62 pre-existing databases storing patch-ids produced by git 1.9 and
63 older (who do not deal with reordered patches) may want to use this
64 option.
65
66 This is the default.
67
69 Part of the git(1) suite
70
71
72
73Git 2.43.0 11/20/2023 GIT-PATCH-ID(1)