]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-patch-id.txt
Merge branch 'en/ort-finalize-after-0-merges-fix'
[thirdparty/git.git] / Documentation / git-patch-id.txt
CommitLineData
7fc9d69f
JH
1git-patch-id(1)
2===============
3
4NAME
5----
c3f0baac 6git-patch-id - Compute unique ID for a patch
7fc9d69f
JH
7
8SYNOPSIS
9--------
7791a1d9 10[verse]
2871f4d4 11'git patch-id' [--stable | --unstable | --verbatim]
7fc9d69f
JH
12
13DESCRIPTION
14-----------
33e8fc87
JH
15Read a patch from the standard input and compute the patch ID for it.
16
30e12b92 17A "patch ID" is nothing but a sum of SHA-1 of the file diffs associated with a
2871f4d4
JZ
18patch, with line numbers ignored. As such, it's "reasonably stable", but at
19the same time also reasonably unique, i.e., two patches that have the same
20"patch ID" are almost guaranteed to be the same thing.
7fc9d69f 21
2871f4d4 22The main usecase for this command is to look for likely duplicate commits.
7fc9d69f 23
0b444cdb 24When dealing with 'git diff-tree' output, it takes advantage of
a77a9222 25the fact that the patch is prefixed with the object name of the
4fa535a1 26commit, and outputs two 40-byte hexadecimal strings. The first
a77a9222
JH
27string is the patch ID, and the second string is the commit ID.
28This can be used to make a mapping from patch ID to commit ID.
29
7fc9d69f
JH
30OPTIONS
31-------
30e12b92 32
2871f4d4
JZ
33--verbatim::
34 Calculate the patch-id of the input as it is given, do not strip
35 any whitespace.
36
37 This is the default if patchid.verbatim is true.
38
30e12b92
MT
39--stable::
40 Use a "stable" sum of hashes as the patch ID. With this option:
41 - Reordering file diffs that make up a patch does not affect the ID.
42 In particular, two patches produced by comparing the same two trees
43 with two different settings for "-O<orderfile>" result in the same
44 patch ID signature, thereby allowing the computed result to be used
45 as a key to index some meta-information about the change between
46 the two trees;
47
48 - Result is different from the value produced by git 1.9 and older
49 or produced when an "unstable" hash (see --unstable below) is
50 configured - even when used on a diff output taken without any use
51 of "-O<orderfile>", thereby making existing databases storing such
52 "unstable" or historical patch-ids unusable.
53
2871f4d4
JZ
54 - All whitespace within the patch is ignored and does not affect the id.
55
30e12b92
MT
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,
60 the result produced is compatible with the patch-id value produced
2871f4d4
JZ
61 by git 1.9 and older and whitespace is ignored. Users with pre-existing
62 databases storing patch-ids produced by git 1.9 and older (who do not deal
63 with reordered patches) may want to use this option.
30e12b92
MT
64
65 This is the default.
66
7fc9d69f
JH
67GIT
68---
9e1f0a85 69Part of the linkgit:git[1] suite