man-pages/man1/git-patch-id.1.html
2021-03-31 01:06:50 +01:00

137 lines
3.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of GIT-PATCH-ID</TITLE>
</HEAD><BODY>
<H1>GIT-PATCH-ID</H1>
Section: Git Manual (1)<BR>Updated: 03/04/2021<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
git-patch-id - Compute unique ID for a patch
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
<PRE>
<I>git patch-id</I> [--stable | --unstable]
</PRE>
<P>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
Read a patch from the standard input and compute the patch ID for it.
<P>
A &quot;patch ID&quot; is nothing but a sum of SHA-1 of the file diffs associated with a patch, with whitespace and line numbers ignored. As such, it's &quot;reasonably stable&quot;, but at the same time also reasonably unique, i.e., two patches that have the same &quot;patch ID&quot; are almost guaranteed to be the same thing.
<P>
IOW, you can use this thing to look for likely duplicate commits.
<P>
When dealing with <I>git diff-tree</I> output, it takes advantage of the fact that the patch is prefixed with the object name of the commit, and outputs two 40-byte hexadecimal strings. The first string is the patch ID, and the second string is the commit ID. This can be used to make a mapping from patch ID to commit ID.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<P>
--stable
<DL COMPACT><DT id="1"><DD>
Use a &quot;stable&quot; sum of hashes as the patch ID. With this option:
<P>
<DL COMPACT><DT id="2"><DD>
&bull;
Reordering file diffs that make up a patch does not affect the ID. In particular, two patches produced by comparing the same two trees with two different settings for &quot;-O&lt;orderfile&gt;&quot; result in the same patch ID signature, thereby allowing the computed result to be used as a key to index some meta-information about the change between the two trees;
</DL>
<P>
<DL COMPACT><DT id="3"><DD>
&bull;
Result is different from the value produced by git 1.9 and older or produced when an &quot;unstable&quot; hash (see --unstable below) is configured - even when used on a diff output taken without any use of &quot;-O&lt;orderfile&gt;&quot;, thereby making existing databases storing such &quot;unstable&quot; or historical patch-ids unusable.
<P>
<DL COMPACT><DT id="4"><DD>
<PRE>
This is the default if patchid.stable is set to true.
</PRE>
</DL>
</DL>
</DL>
<P>
--unstable
<DL COMPACT><DT id="5"><DD>
Use an &quot;unstable&quot; hash as the patch ID. With this option, the result produced is compatible with the patch-id value produced by git 1.9 and older. Users with pre-existing databases storing patch-ids produced by git 1.9 and older (who do not deal with reordered patches) may want to use this option.
<P>
<DL COMPACT><DT id="6"><DD>
<PRE>
This is the default.
</PRE>
</DL>
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>GIT</H2>
<P>
Part of the <B><A HREF="/cgi-bin/man/man2html?1+git">git</A></B>(1) suite
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="7"><A HREF="#lbAB">NAME</A><DD>
<DT id="8"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="9"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="10"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="11"><A HREF="#lbAF">GIT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:14 GMT, March 31, 2021
</BODY>
</HTML>