cleanup duplicate name_compare() functions
[git.git] / Documentation / git-patch-id.txt
blob31efc587ee694da6885ed1ce9d1a4c1419808397
1 git-patch-id(1)
2 ===============
4 NAME
5 ----
6 git-patch-id - Compute unique ID for a patch
8 SYNOPSIS
9 --------
10 [verse]
11 'git patch-id' [--stable | --unstable] < <patch>
13 DESCRIPTION
14 -----------
15 A "patch ID" is nothing but a sum of SHA-1 of the file diffs associated with a
16 patch, with whitespace and line numbers ignored.  As such, it's "reasonably
17 stable", but at the same time also reasonably unique, i.e., two patches that
18 have the same "patch ID" are almost guaranteed to be the same thing.
20 IOW, you can use this thing to look for likely duplicate commits.
22 When dealing with 'git diff-tree' output, it takes advantage of
23 the fact that the patch is prefixed with the object name of the
24 commit, and outputs two 40-byte hexadecimal strings.  The first
25 string is the patch ID, and the second string is the commit ID.
26 This can be used to make a mapping from patch ID to commit ID.
28 OPTIONS
29 -------
31 --stable::
32         Use a "stable" sum of hashes as the patch ID. With this option:
33          - Reordering file diffs that make up a patch does not affect the ID.
34            In particular, two patches produced by comparing the same two trees
35            with two different settings for "-O<orderfile>" result in the same
36            patch ID signature, thereby allowing the computed result to be used
37            as a key to index some meta-information about the change between
38            the two trees;
40          - Result is different from the value produced by git 1.9 and older
41            or produced when an "unstable" hash (see --unstable below) is
42            configured - even when used on a diff output taken without any use
43            of "-O<orderfile>", thereby making existing databases storing such
44            "unstable" or historical patch-ids unusable.
46         This is the default if patchid.stable is set to true.
48 --unstable::
49         Use an "unstable" hash as the patch ID. With this option,
50         the result produced is compatible with the patch-id value produced
51         by git 1.9 and older.  Users with pre-existing databases storing
52         patch-ids produced by git 1.9 and older (who do not deal with reordered
53         patches) may want to use this option.
55         This is the default.
57 <patch>::
58         The diff to create the ID of.
60 GIT
61 ---
62 Part of the linkgit:git[1] suite