blob: d3c92d7a428d749845d3ba585db1fcea108f7efb [file] [log] [blame]
Junio C Hamano300c9262025-03-26 07:43:111<!DOCTYPE html>
2<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
3<head>
4<meta charset="UTF-8"/>
5<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
6<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
7<meta name="generator" content="Asciidoctor 2.0.23"/>
8<title>git-diff-pairs(1)</title>
9<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700"/>
10<style>
11/*! Asciidoctor default stylesheet | MIT License | https://asciidoctor.org */
12/* Uncomment the following line when using as a custom stylesheet */
13/* @import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700"; */
14html{font-family:sans-serif;-webkit-text-size-adjust:100%}
15a{background:none}
16a:focus{outline:thin dotted}
17a:active,a:hover{outline:0}
18h1{font-size:2em;margin:.67em 0}
19b,strong{font-weight:bold}
20abbr{font-size:.9em}
21abbr[title]{cursor:help;border-bottom:1px dotted #dddddf;text-decoration:none}
22dfn{font-style:italic}
23hr{height:0}
24mark{background:#ff0;color:#000}
25code,kbd,pre,samp{font-family:monospace;font-size:1em}
26pre{white-space:pre-wrap}
27q{quotes:"\201C" "\201D" "\2018" "\2019"}
28small{font-size:80%}
29sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
30sup{top:-.5em}
31sub{bottom:-.25em}
32img{border:0}
33svg:not(:root){overflow:hidden}
34figure{margin:0}
35audio,video{display:inline-block}
36audio:not([controls]){display:none;height:0}
37fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}
38legend{border:0;padding:0}
39button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}
40button,input{line-height:normal}
41button,select{text-transform:none}
42button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}
43button[disabled],html input[disabled]{cursor:default}
44input[type=checkbox],input[type=radio]{padding:0}
45button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}
46textarea{overflow:auto;vertical-align:top}
47table{border-collapse:collapse;border-spacing:0}
48*,::before,::after{box-sizing:border-box}
49html,body{font-size:100%}
50body{background:#fff;color:rgba(0,0,0,.8);padding:0;margin:0;font-family:"Noto Serif","DejaVu Serif",serif;line-height:1;position:relative;cursor:auto;-moz-tab-size:4;-o-tab-size:4;tab-size:4;word-wrap:anywhere;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}
51a:hover{cursor:pointer}
52img,object,embed{max-width:100%;height:auto}
53object,embed{height:100%}
54img{-ms-interpolation-mode:bicubic}
55.left{float:left!important}
56.right{float:right!important}
57.text-left{text-align:left!important}
58.text-right{text-align:right!important}
59.text-center{text-align:center!important}
60.text-justify{text-align:justify!important}
61.hide{display:none}
62img,object,svg{display:inline-block;vertical-align:middle}
63textarea{height:auto;min-height:50px}
64select{width:100%}
65.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#7a2518;font-weight:400;margin-top:0;margin-bottom:.25em}
66div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0}
67a{color:#2156a5;text-decoration:underline;line-height:inherit}
68a:hover,a:focus{color:#1d4b8f}
69a img{border:0}
70p{line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility}
71p aside{font-size:.875em;line-height:1.35;font-style:italic}
72h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:"Open Sans","DejaVu Sans",sans-serif;font-weight:300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:.5em;line-height:1.0125em}
73h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#e99b8f;line-height:0}
74h1{font-size:2.125em}
75h2{font-size:1.6875em}
76h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em}
77h4,h5{font-size:1.125em}
78h6{font-size:1em}
79hr{border:solid #dddddf;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em}
80em,i{font-style:italic;line-height:inherit}
81strong,b{font-weight:bold;line-height:inherit}
82small{font-size:60%;line-height:inherit}
83code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)}
84ul,ol,dl{line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit}
85ul,ol{margin-left:1.5em}
86ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0}
87ul.circle{list-style-type:circle}
88ul.disc{list-style-type:disc}
89ul.square{list-style-type:square}
90ul.circle ul:not([class]),ul.disc ul:not([class]),ul.square ul:not([class]){list-style:inherit}
91ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0}
92dl dt{margin-bottom:.3125em;font-weight:bold}
93dl dd{margin-bottom:1.25em}
94blockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd}
95blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,.85)}
96@media screen and (min-width:768px){h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2}
97h1{font-size:2.75em}
98h2{font-size:2.3125em}
99h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em}
100h4{font-size:1.4375em}}
101table{background:#fff;margin-bottom:1.25em;border:1px solid #dedede;word-wrap:normal}
102table thead,table tfoot{background:#f7f8f7}
103table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;color:rgba(0,0,0,.8);text-align:left}
104table tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)}
105table tr.even,table tr.alt{background:#f8f8f7}
106table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{line-height:1.6}
107h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em}
108h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title strong,h4 strong,h5 strong,h6 strong{font-weight:400}
109.center{margin-left:auto;margin-right:auto}
110.stretch{width:100%}
111.clearfix::before,.clearfix::after,.float-group::before,.float-group::after{content:" ";display:table}
112.clearfix::after,.float-group::after{clear:both}
113:not(pre).nobreak{word-wrap:normal}
114:not(pre).nowrap{white-space:nowrap}
115:not(pre).pre-wrap{white-space:pre-wrap}
116:not(pre):not([class^=L])>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background:#f7f7f8;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed}
117pre{color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;line-height:1.45;text-rendering:optimizeSpeed}
118pre code,pre pre{color:inherit;font-size:inherit;line-height:inherit}
119pre>code{display:block}
120pre.nowrap,pre.nowrap pre{white-space:pre;word-wrap:normal}
121em em{font-style:normal}
122strong strong{font-weight:400}
123.keyseq{color:rgba(51,51,51,.8)}
124kbd{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;display:inline-block;color:rgba(0,0,0,.8);font-size:.65em;line-height:1.45;background:#f7f7f7;border:1px solid #ccc;border-radius:3px;box-shadow:0 1px 0 rgba(0,0,0,.2),inset 0 0 0 .1em #fff;margin:0 .15em;padding:.2em .5em;vertical-align:middle;position:relative;top:-.1em;white-space:nowrap}
125.keyseq kbd:first-child{margin-left:0}
126.keyseq kbd:last-child{margin-right:0}
127.menuseq,.menuref{color:#000}
128.menuseq b:not(.caret),.menuref{font-weight:inherit}
129.menuseq{word-spacing:-.02em}
130.menuseq b.caret{font-size:1.25em;line-height:.8}
131.menuseq i.caret{font-weight:bold;text-align:center;width:.45em}
132b.button::before,b.button::after{position:relative;top:-1px;font-weight:400}
133b.button::before{content:"[";padding:0 3px 0 2px}
134b.button::after{content:"]";padding:0 2px 0 3px}
135p a>code:hover{color:rgba(0,0,0,.9)}
136#header,#content,#footnotes,#footer{width:100%;margin:0 auto;max-width:62.5em;*zoom:1;position:relative;padding-left:.9375em;padding-right:.9375em}
137#header::before,#header::after,#content::before,#content::after,#footnotes::before,#footnotes::after,#footer::before,#footer::after{content:" ";display:table}
138#header::after,#content::after,#footnotes::after,#footer::after{clear:both}
139#content{margin-top:1.25em}
140#content::before{content:none}
141#header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0}
142#header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #dddddf}
143#header>h1:only-child{border-bottom:1px solid #dddddf;padding-bottom:8px}
144#header .details{border-bottom:1px solid #dddddf;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:flex;flex-flow:row wrap}
145#header .details span:first-child{margin-left:-.125em}
146#header .details span.email a{color:rgba(0,0,0,.85)}
147#header .details br{display:none}
148#header .details br+span::before{content:"\00a0\2013\00a0"}
149#header .details br+span.author::before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,.85)}
150#header .details br+span#revremark::before{content:"\00a0|\00a0"}
151#header #revnumber{text-transform:capitalize}
152#header #revnumber::after{content:"\00a0"}
153#content>h1:first-child:not([class]){color:rgba(0,0,0,.85);border-bottom:1px solid #dddddf;padding-bottom:8px;margin-top:0;padding-top:1rem;margin-bottom:1.25rem}
154#toc{border-bottom:1px solid #e7e7e9;padding-bottom:.5em}
155#toc>ul{margin-left:.125em}
156#toc ul.sectlevel0>li>a{font-style:italic}
157#toc ul.sectlevel0 ul.sectlevel1{margin:.5em 0}
158#toc ul{font-family:"Open Sans","DejaVu Sans",sans-serif;list-style-type:none}
159#toc li{line-height:1.3334;margin-top:.3334em}
160#toc a{text-decoration:none}
161#toc a:active{text-decoration:underline}
162#toctitle{color:#7a2518;font-size:1.2em}
163@media screen and (min-width:768px){#toctitle{font-size:1.375em}
164body.toc2{padding-left:15em;padding-right:0}
165body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #dddddf;padding-bottom:8px}
166#toc.toc2{margin-top:0!important;background:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #e7e7e9;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto}
167#toc.toc2 #toctitle{margin-top:0;margin-bottom:.8rem;font-size:1.2em}
168#toc.toc2>ul{font-size:.9em;margin-bottom:0}
169#toc.toc2 ul ul{margin-left:0;padding-left:1em}
170#toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em}
171body.toc2.toc-right{padding-left:0;padding-right:15em}
172body.toc2.toc-right #toc.toc2{border-right-width:0;border-left:1px solid #e7e7e9;left:auto;right:0}}
173@media screen and (min-width:1280px){body.toc2{padding-left:20em;padding-right:0}
174#toc.toc2{width:20em}
175#toc.toc2 #toctitle{font-size:1.375em}
176#toc.toc2>ul{font-size:.95em}
177#toc.toc2 ul ul{padding-left:1.25em}
178body.toc2.toc-right{padding-left:0;padding-right:20em}}
179#content #toc{border:1px solid #e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;border-radius:4px}
180#content #toc>:first-child{margin-top:0}
181#content #toc>:last-child{margin-bottom:0}
182#footer{max-width:none;background:rgba(0,0,0,.8);padding:1.25em}
183#footer-text{color:hsla(0,0%,100%,.8);line-height:1.44}
184#content{margin-bottom:.625em}
185.sect1{padding-bottom:.625em}
186@media screen and (min-width:768px){#content{margin-bottom:1.25em}
187.sect1{padding-bottom:1.25em}}
188.sect1:last-child{padding-bottom:0}
189.sect1+.sect1{border-top:1px solid #e7e7e9}
190#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400}
191#content h1>a.anchor::before,h2>a.anchor::before,h3>a.anchor::before,#toctitle>a.anchor::before,.sidebarblock>.content>.title>a.anchor::before,h4>a.anchor::before,h5>a.anchor::before,h6>a.anchor::before{content:"\00A7";font-size:.85em;display:block;padding-top:.1em}
192#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible}
193#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#ba3925;text-decoration:none}
194#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#a53221}
195details,.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em}
196details{margin-left:1.25rem}
197details>summary{cursor:pointer;display:block;position:relative;line-height:1.6;margin-bottom:.625rem;outline:none;-webkit-tap-highlight-color:transparent}
198details>summary::-webkit-details-marker{display:none}
199details>summary::before{content:"";border:solid transparent;border-left:solid;border-width:.3em 0 .3em .5em;position:absolute;top:.5em;left:-1.25rem;transform:translateX(15%)}
200details[open]>summary::before{border:solid transparent;border-top:solid;border-width:.5em .3em 0;transform:translateY(15%)}
201details>summary::after{content:"";width:1.25rem;height:1em;position:absolute;top:.3em;left:-1.25rem}
202.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:"Noto Serif","DejaVu Serif",serif;font-size:1rem;font-style:italic}
203table.tableblock.fit-content>caption.title{white-space:nowrap;width:0}
204.paragraph.lead>p,#preamble>.sectionbody>[class=paragraph]:first-of-type p{font-size:1.21875em;line-height:1.6;color:rgba(0,0,0,.85)}
205.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}
206.admonitionblock>table td.icon{text-align:center;width:80px}
207.admonitionblock>table td.icon img{max-width:none}
208.admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase}
209.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #dddddf;color:rgba(0,0,0,.6);word-wrap:anywhere}
210.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}
211.exampleblock>.content{border:1px solid #e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;border-radius:4px}
212.sidebarblock{border:1px solid #dbdbd6;margin-bottom:1.25em;padding:1.25em;background:#f3f3f2;border-radius:4px}
213.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center}
214.exampleblock>.content>:first-child,.sidebarblock>.content>:first-child{margin-top:0}
215.exampleblock>.content>:last-child,.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0}
216.literalblock pre,.listingblock>.content>pre{border-radius:4px;overflow-x:auto;padding:1em;font-size:.8125em}
217@media screen and (min-width:768px){.literalblock pre,.listingblock>.content>pre{font-size:.90625em}}
218@media screen and (min-width:1280px){.literalblock pre,.listingblock>.content>pre{font-size:1em}}
219.literalblock pre,.listingblock>.content>pre:not(.highlight),.listingblock>.content>pre[class=highlight],.listingblock>.content>pre[class^="highlight "]{background:#f7f7f8}
220.literalblock.output pre{color:#f7f7f8;background:rgba(0,0,0,.9)}
221.listingblock>.content{position:relative}
222.listingblock code[data-lang]::before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:inherit;opacity:.5}
223.listingblock:hover code[data-lang]::before{display:block}
224.listingblock.terminal pre .command::before{content:attr(data-prompt);padding-right:.5em;color:inherit;opacity:.5}
225.listingblock.terminal pre .command:not([data-prompt])::before{content:"$"}
226.listingblock pre.highlightjs{padding:0}
227.listingblock pre.highlightjs>code{padding:1em;border-radius:4px}
228.listingblock pre.prettyprint{border-width:0}
229.prettyprint{background:#f7f7f8}
230pre.prettyprint .linenums{line-height:1.45;margin-left:2em}
231pre.prettyprint li{background:none;list-style-type:inherit;padding-left:0}
232pre.prettyprint li code[data-lang]::before{opacity:1}
233pre.prettyprint li:not(:first-child) code[data-lang]::before{display:none}
234table.linenotable{border-collapse:separate;border:0;margin-bottom:0;background:none}
235table.linenotable td[class]{color:inherit;vertical-align:top;padding:0;line-height:inherit;white-space:normal}
236table.linenotable td.code{padding-left:.75em}
237table.linenotable td.linenos,pre.pygments .linenos{border-right:1px solid;opacity:.35;padding-right:.5em;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}
238pre.pygments span.linenos{display:inline-block;margin-right:.75em}
239.quoteblock{margin:0 1em 1.25em 1.5em;display:table}
240.quoteblock:not(.excerpt)>.title{margin-left:-1.5em;margin-bottom:.75em}
241.quoteblock blockquote,.quoteblock p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify}
242.quoteblock blockquote{margin:0;padding:0;border:0}
243.quoteblock blockquote::before{content:"\201c";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)}
244.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0}
245.quoteblock .attribution{margin-top:.75em;margin-right:.5ex;text-align:right}
246.verseblock{margin:0 1em 1.25em}
247.verseblock pre{font-family:"Open Sans","DejaVu Sans",sans-serif;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility}
248.verseblock pre strong{font-weight:400}
249.verseblock .attribution{margin-top:1.25rem;margin-left:.5ex}
250.quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic}
251.quoteblock .attribution br,.verseblock .attribution br{display:none}
252.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.025em;color:rgba(0,0,0,.6)}
253.quoteblock.abstract blockquote::before,.quoteblock.excerpt blockquote::before,.quoteblock .quoteblock blockquote::before{display:none}
254.quoteblock.abstract blockquote,.quoteblock.abstract p,.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{line-height:1.6;word-spacing:0}
255.quoteblock.abstract{margin:0 1em 1.25em;display:block}
256.quoteblock.abstract>.title{margin:0 0 .375em;font-size:1.15em;text-align:center}
257.quoteblock.excerpt>blockquote,.quoteblock .quoteblock{padding:0 0 .25em 1em;border-left:.25em solid #dddddf}
258.quoteblock.excerpt,.quoteblock .quoteblock{margin-left:0}
259.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{color:inherit;font-size:1.0625rem}
260.quoteblock.excerpt .attribution,.quoteblock .quoteblock .attribution{color:inherit;font-size:.85rem;text-align:left;margin-right:0}
261p.tableblock:last-child{margin-bottom:0}
262td.tableblock>.content{margin-bottom:1.25em;word-wrap:anywhere}
263td.tableblock>.content>:last-child{margin-bottom:-1.25em}
264table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede}
265table.grid-all>*>tr>*{border-width:1px}
266table.grid-cols>*>tr>*{border-width:0 1px}
267table.grid-rows>*>tr>*{border-width:1px 0}
268table.frame-all{border-width:1px}
269table.frame-ends{border-width:1px 0}
270table.frame-sides{border-width:0 1px}
271table.frame-none>colgroup+*>:first-child>*,table.frame-sides>colgroup+*>:first-child>*{border-top-width:0}
272table.frame-none>:last-child>:last-child>*,table.frame-sides>:last-child>:last-child>*{border-bottom-width:0}
273table.frame-none>*>tr>:first-child,table.frame-ends>*>tr>:first-child{border-left-width:0}
274table.frame-none>*>tr>:last-child,table.frame-ends>*>tr>:last-child{border-right-width:0}
275table.stripes-all>*>tr,table.stripes-odd>*>tr:nth-of-type(odd),table.stripes-even>*>tr:nth-of-type(even),table.stripes-hover>*>tr:hover{background:#f8f8f7}
276th.halign-left,td.halign-left{text-align:left}
277th.halign-right,td.halign-right{text-align:right}
278th.halign-center,td.halign-center{text-align:center}
279th.valign-top,td.valign-top{vertical-align:top}
280th.valign-bottom,td.valign-bottom{vertical-align:bottom}
281th.valign-middle,td.valign-middle{vertical-align:middle}
282table thead th,table tfoot th{font-weight:bold}
283tbody tr th{background:#f7f8f7}
284tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold}
285p.tableblock>code:only-child{background:none;padding:0}
286p.tableblock{font-size:1em}
287ol{margin-left:1.75em}
288ul li ol{margin-left:1.5em}
289dl dd{margin-left:1.125em}
290dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}
291li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em}
292ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none}
293ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:.625em}
294ul.unstyled,ol.unstyled{margin-left:0}
295li>p:empty:only-child::before{content:"";display:inline-block}
296ul.checklist>li>p:first-child{margin-left:-1em}
297ul.checklist>li>p:first-child>.fa-square-o:first-child,ul.checklist>li>p:first-child>.fa-check-square-o:first-child{width:1.25em;font-size:.8em;position:relative;bottom:.125em}
298ul.checklist>li>p:first-child>input[type=checkbox]:first-child{margin-right:.25em}
299ul.inline{display:flex;flex-flow:row wrap;list-style:none;margin:0 0 .625em -1.25em}
300ul.inline>li{margin-left:1.25em}
301.unstyled dl dt{font-weight:400;font-style:normal}
302ol.arabic{list-style-type:decimal}
303ol.decimal{list-style-type:decimal-leading-zero}
304ol.loweralpha{list-style-type:lower-alpha}
305ol.upperalpha{list-style-type:upper-alpha}
306ol.lowerroman{list-style-type:lower-roman}
307ol.upperroman{list-style-type:upper-roman}
308ol.lowergreek{list-style-type:lower-greek}
309.hdlist>table,.colist>table{border:0;background:none}
310.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none}
311td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em}
312td.hdlist1{font-weight:bold;padding-bottom:1.25em}
313td.hdlist2{word-wrap:anywhere}
314.literalblock+.colist,.listingblock+.colist{margin-top:-.5em}
315.colist td:not([class]):first-child{padding:.4em .75em 0;line-height:1;vertical-align:top}
316.colist td:not([class]):first-child img{max-width:none}
317.colist td:not([class]):last-child{padding:.25em 0}
318.thumb,.th{line-height:0;display:inline-block;border:4px solid #fff;box-shadow:0 0 0 1px #ddd}
319.imageblock.left{margin:.25em .625em 1.25em 0}
320.imageblock.right{margin:.25em 0 1.25em .625em}
321.imageblock>.title{margin-bottom:0}
322.imageblock.thumb,.imageblock.th{border-width:6px}
323.imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em}
324.image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0}
325.image.left{margin-right:.625em}
326.image.right{margin-left:.625em}
327a.image{text-decoration:none;display:inline-block}
328a.image object{pointer-events:none}
329sup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super}
330sup.footnote a,sup.footnoteref a{text-decoration:none}
331sup.footnote a:active,sup.footnoteref a:active,#footnotes .footnote a:first-of-type:active{text-decoration:underline}
332#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em}
333#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em;border-width:1px 0 0}
334#footnotes .footnote{padding:0 .375em 0 .225em;line-height:1.3334;font-size:.875em;margin-left:1.2em;margin-bottom:.2em}
335#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none;margin-left:-1.05em}
336#footnotes .footnote:last-of-type{margin-bottom:0}
337#content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0}
338div.unbreakable{page-break-inside:avoid}
339.big{font-size:larger}
340.small{font-size:smaller}
341.underline{text-decoration:underline}
342.overline{text-decoration:overline}
343.line-through{text-decoration:line-through}
344.aqua{color:#00bfbf}
345.aqua-background{background:#00fafa}
346.black{color:#000}
347.black-background{background:#000}
348.blue{color:#0000bf}
349.blue-background{background:#0000fa}
350.fuchsia{color:#bf00bf}
351.fuchsia-background{background:#fa00fa}
352.gray{color:#606060}
353.gray-background{background:#7d7d7d}
354.green{color:#006000}
355.green-background{background:#007d00}
356.lime{color:#00bf00}
357.lime-background{background:#00fa00}
358.maroon{color:#600000}
359.maroon-background{background:#7d0000}
360.navy{color:#000060}
361.navy-background{background:#00007d}
362.olive{color:#606000}
363.olive-background{background:#7d7d00}
364.purple{color:#600060}
365.purple-background{background:#7d007d}
366.red{color:#bf0000}
367.red-background{background:#fa0000}
368.silver{color:#909090}
369.silver-background{background:#bcbcbc}
370.teal{color:#006060}
371.teal-background{background:#007d7d}
372.white{color:#bfbfbf}
373.white-background{background:#fafafa}
374.yellow{color:#bfbf00}
375.yellow-background{background:#fafa00}
376span.icon>.fa{cursor:default}
377a span.icon>.fa{cursor:inherit}
378.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
379.admonitionblock td.icon .icon-note::before{content:"\f05a";color:#19407c}
380.admonitionblock td.icon .icon-tip::before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111}
381.admonitionblock td.icon .icon-warning::before{content:"\f071";color:#bf6900}
382.admonitionblock td.icon .icon-caution::before{content:"\f06d";color:#bf3400}
383.admonitionblock td.icon .icon-important::before{content:"\f06a";color:#bf0000}
384.conum[data-value]{display:inline-block;color:#fff!important;background:rgba(0,0,0,.8);border-radius:50%;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold}
385.conum[data-value] *{color:#fff!important}
386.conum[data-value]+b{display:none}
387.conum[data-value]::after{content:attr(data-value)}
388pre .conum[data-value]{position:relative;top:-.125em}
389b.conum *{color:inherit!important}
390.conum:not([data-value]):empty{display:none}
391dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility}
392h1,h2,p,td.content,span.alt,summary{letter-spacing:-.01em}
393p strong,td.content strong,div.footnote strong{letter-spacing:-.005em}
394p,blockquote,dt,td.content,td.hdlist1,span.alt,summary{font-size:1.0625rem}
395p{margin-bottom:1.25rem}
396.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em}
397.exampleblock>.content{background:#fffef7;border-color:#e0e0dc;box-shadow:0 1px 4px #e0e0dc}
398.print-only{display:none!important}
399@page{margin:1.25cm .75cm}
400@media print{*{box-shadow:none!important;text-shadow:none!important}
401html{font-size:80%}
402a{color:inherit!important;text-decoration:underline!important}
403a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important}
404a[href^="http:"]:not(.bare)::after,a[href^="https:"]:not(.bare)::after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em}
405abbr[title]{border-bottom:1px dotted}
406abbr[title]::after{content:" (" attr(title) ")"}
407pre,blockquote,tr,img,object,svg{page-break-inside:avoid}
408thead{display:table-header-group}
409svg{max-width:100%}
410p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3}
411h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid}
412#header,#content,#footnotes,#footer{max-width:none}
413#toc,.sidebarblock,.exampleblock>.content{background:none!important}
414#toc{border-bottom:1px solid #dddddf!important;padding-bottom:0!important}
415body.book #header{text-align:center}
416body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em}
417body.book #header .details{border:0!important;display:block;padding:0!important}
418body.book #header .details span:first-child{margin-left:0!important}
419body.book #header .details br{display:block}
420body.book #header .details br+span::before{content:none!important}
421body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important}
422body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always}
423.listingblock code[data-lang]::before{display:block}
424#footer{padding:0 .9375em}
425.hide-on-print{display:none!important}
426.print-only{display:block!important}
427.hide-for-print{display:none!important}
428.show-for-print{display:inherit!important}}
429@media amzn-kf8,print{#header>h1:first-child{margin-top:1.25rem}
430.sect1{padding:0!important}
431.sect1+.sect1{border:0}
432#footer{background:none}
433#footer-text{color:rgba(0,0,0,.6);font-size:.9em}}
434@media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}}
435</style>
436<style>
437pre>code {
438 display: inline;
439}
440</style>
441</head>
442<body class="manpage">
443<div id="header">
444<h1>git-diff-pairs(1) Manual Page</h1>
445<h2 id="_name">NAME</h2>
446<div class="sectionbody">
447<p>git-diff-pairs - Compare the content and mode of provided blob pairs</p>
448</div>
449</div>
450<div id="content">
451<div class="sect1">
452<h2 id="_synopsis">SYNOPSIS</h2>
453<div class="sectionbody">
454<div class="verseblock">
455<pre class="content"><code>git</code> <code>diff-pairs</code> <code>-z</code> [<em>&lt;diff-options&gt;</em>]</pre>
456</div>
457</div>
458</div>
459<div class="sect1">
460<h2 id="_description">DESCRIPTION</h2>
461<div class="sectionbody">
462<div class="paragraph">
463<p>Show changes for file pairs provided on stdin. Input for this command must be
464in the NUL-terminated raw output format as generated by commands such as <code>git</code>
465<code>diff-tree</code> <code>-z</code> <code>-r</code> <code>--raw</code>. By default, the outputted diffs are computed and shown
466in the patch format when stdin closes.</p>
467</div>
468<div class="paragraph">
469<p>A single NUL byte may be written to stdin between raw input lines to compute
470file pair diffs up to that point instead of waiting for stdin to close. A NUL
471byte is also written to the output to delimit between these batches of diffs.</p>
472</div>
473<div class="paragraph">
474<p>Usage of this command enables the traditional diff pipeline to be broken up
475into separate stages where <code>diff-pairs</code> acts as the output phase. Other
476commands, such as <code>diff-tree</code>, may serve as a frontend to compute the raw
477diff format used as input.</p>
478</div>
479<div class="paragraph">
480<p>Instead of computing diffs via <code>git</code> <code>diff-tree</code> <code>-p</code> <code>-M</code> in one step, <code>diff-tree</code>
481can compute the file pairs and rename information without the blob diffs. This
482output can be fed to <code>diff-pairs</code> to generate the underlying blob diffs as done
483in the following example:</p>
484</div>
485<div class="listingblock">
486<div class="content">
487<pre>git diff-tree -z -r -M $a $b |
488git diff-pairs -z</pre>
489</div>
490</div>
491<div class="paragraph">
492<p>Computing the tree diff upfront with rename information allows patch output
493from <code>diff-pairs</code> to be progressively computed over the course of potentially
494multiple invocations.</p>
495</div>
496<div class="paragraph">
497<p>Pathspecs are not currently supported by <code>diff-pairs</code>. Pathspec limiting should
498be performed by the upstream command generating the raw diffs used as input.</p>
499</div>
500<div class="paragraph">
501<p>Tree objects are not currently supported as input and are rejected.</p>
502</div>
503<div class="paragraph">
504<p>Abbreviated object IDs in the <code>diff-pairs</code> input are not supported. Outputted
505object IDs can be abbreviated using the <code>--abbrev</code> option.</p>
506</div>
507</div>
508</div>
509<div class="sect1">
510<h2 id="_options">OPTIONS</h2>
511<div class="sectionbody">
512<div class="dlist">
513<dl>
514<dt class="hdlist1"><code>-p</code></dt>
515<dt class="hdlist1"><code>-u</code></dt>
516<dt class="hdlist1"><code>--patch</code></dt>
517<dd>
518<p>Generate patch (see <a href="#generate_patch_text_with_p">Generating patch text with -p</a>).</p>
519</dd>
520<dt class="hdlist1"><code>-s</code></dt>
521<dt class="hdlist1"><code>--no-patch</code></dt>
522<dd>
523<p>Suppress all output from the diff machinery. Useful for
524commands like <code>git</code> <code>show</code> that show the patch by default to
525squelch their output, or to cancel the effect of options like
526<code>--patch</code>, <code>--stat</code> earlier on the command line in an alias.</p>
527</dd>
528<dt class="hdlist1"><code>-U</code><em>&lt;n&gt;</em></dt>
529<dt class="hdlist1"><code>--unified=</code><em>&lt;n&gt;</em></dt>
530<dd>
531<p>Generate diffs with <em>&lt;n&gt;</em> lines of context instead of
532the usual three.
533Implies <code>--patch</code>.</p>
534</dd>
535<dt class="hdlist1"><code>--output=</code><em>&lt;file&gt;</em></dt>
536<dd>
537<p>Output to a specific file instead of stdout.</p>
538</dd>
539<dt class="hdlist1"><code>--output-indicator-new=</code><em>&lt;char&gt;</em></dt>
540<dt class="hdlist1"><code>--output-indicator-old=</code><em>&lt;char&gt;</em></dt>
541<dt class="hdlist1"><code>--output-indicator-context=</code><em>&lt;char&gt;</em></dt>
542<dd>
543<p>Specify the character used to indicate new, old or context
544lines in the generated patch. Normally they are <code>+</code>, <code>-</code> and
545' ' respectively.</p>
546</dd>
547<dt class="hdlist1"><code>--raw</code></dt>
548<dd>
549<p>Generate the diff in raw format.
550This is the default.</p>
551</dd>
552<dt class="hdlist1"><code>--patch-with-raw</code></dt>
553<dd>
554<p>Synonym for <code>-p</code> <code>--raw</code>.</p>
555</dd>
556<dt class="hdlist1"><code>--indent-heuristic</code></dt>
557<dd>
558<p>Enable the heuristic that shifts diff hunk boundaries to make patches
559easier to read. This is the default.</p>
560</dd>
561<dt class="hdlist1"><code>--no-indent-heuristic</code></dt>
562<dd>
563<p>Disable the indent heuristic.</p>
564</dd>
565<dt class="hdlist1"><code>--minimal</code></dt>
566<dd>
567<p>Spend extra time to make sure the smallest possible
568diff is produced.</p>
569</dd>
570<dt class="hdlist1"><code>--patience</code></dt>
571<dd>
572<p>Generate a diff using the "patience diff" algorithm.</p>
573</dd>
574<dt class="hdlist1"><code>--histogram</code></dt>
575<dd>
576<p>Generate a diff using the "histogram diff" algorithm.</p>
577</dd>
578<dt class="hdlist1"><code>--anchored=</code><em>&lt;text&gt;</em></dt>
579<dd>
580<p>Generate a diff using the "anchored diff" algorithm.</p>
581<div class="paragraph">
582<p>This option may be specified more than once.</p>
583</div>
584<div class="paragraph">
585<p>If a line exists in both the source and destination, exists only once,
586and starts with <em>&lt;text&gt;</em>, this algorithm attempts to prevent it from
587appearing as a deletion or addition in the output. It uses the "patience
588diff" algorithm internally.</p>
589</div>
590</dd>
591<dt class="hdlist1"><code>--diff-algorithm=</code>(<code>patience</code>|<code>minimal</code>|<code>histogram</code>|<code>myers</code>)</dt>
592<dd>
593<p>Choose a diff algorithm. The variants are as follows:</p>
594<div class="openblock">
595<div class="content">
596<div class="dlist">
597<dl>
598<dt class="hdlist1"><code>default</code></dt>
599<dt class="hdlist1"><code>myers</code></dt>
600<dd>
601<p>The basic greedy diff algorithm. Currently, this is the default.</p>
602</dd>
603<dt class="hdlist1"><code>minimal</code></dt>
604<dd>
605<p>Spend extra time to make sure the smallest possible diff is
606produced.</p>
607</dd>
608<dt class="hdlist1"><code>patience</code></dt>
609<dd>
610<p>Use "patience diff" algorithm when generating patches.</p>
611</dd>
612<dt class="hdlist1"><code>histogram</code></dt>
613<dd>
614<p>This algorithm extends the patience algorithm to "support
615low-occurrence common elements".</p>
616</dd>
617</dl>
618</div>
619</div>
620</div>
621<div class="paragraph">
622<p>For instance, if you configured the <code>diff.algorithm</code> variable to a
623non-default value and want to use the default one, then you
624have to use <code>--diff-algorithm=default</code> option.</p>
625</div>
626</dd>
627<dt class="hdlist1"><code>--stat</code>[<code>=</code><em>&lt;width&gt;</em>[<code>,</code><em>&lt;name-width&gt;</em>[<code>,</code><em>&lt;count&gt;</em>]]]</dt>
628<dd>
629<p>Generate a diffstat. By default, as much space as necessary
630will be used for the filename part, and the rest for the graph
631part. Maximum width defaults to terminal width, or 80 columns
632if not connected to a terminal, and can be overridden by
633<em>&lt;width&gt;</em>. The width of the filename part can be limited by
634giving another width <em>&lt;name-width&gt;</em> after a comma or by setting
635<code>diff.statNameWidth=</code><em>&lt;name-width&gt;</em>. The width of the graph part can be
636limited by using <code>--stat-graph-width=</code><em>&lt;graph-width&gt;</em> or by setting
637<code>diff.statGraphWidth=</code><em>&lt;graph-width&gt;</em>. Using <code>--stat</code> or
638<code>--stat-graph-width</code> affects all commands generating a stat graph,
639while setting <code>diff.statNameWidth</code> or <code>diff.statGraphWidth</code>
640does not affect <code>git</code> <code>format-patch</code>.
641By giving a third parameter <em>&lt;count&gt;</em>, you can limit the output to
Junio C Hamanoe03f5992025-04-23 22:24:29642the first <em>&lt;count&gt;</em> lines, followed by <code>...</code> if there are more.</p>
Junio C Hamano300c9262025-03-26 07:43:11643<div class="paragraph">
644<p>These parameters can also be set individually with <code>--stat-width=</code><em>&lt;width&gt;</em>,
645<code>--stat-name-width=</code><em>&lt;name-width&gt;</em> and <code>--stat-count=</code><em>&lt;count&gt;</em>.</p>
646</div>
647</dd>
648<dt class="hdlist1"><code>--compact-summary</code></dt>
649<dd>
650<p>Output a condensed summary of extended header information such
651as file creations or deletions ("new" or "gone", optionally <code>+l</code>
652if it&#8217;s a symlink) and mode changes (<code>+x</code> or <code>-x</code> for adding
653or removing executable bit respectively) in diffstat. The
654information is put between the filename part and the graph
655part. Implies <code>--stat</code>.</p>
656</dd>
657<dt class="hdlist1"><code>--numstat</code></dt>
658<dd>
659<p>Similar to <code>--stat</code>, but shows number of added and
660deleted lines in decimal notation and pathname without
661abbreviation, to make it more machine friendly. For
662binary files, outputs two <code>-</code> instead of saying
663<code>0</code> <code>0</code>.</p>
664</dd>
665<dt class="hdlist1"><code>--shortstat</code></dt>
666<dd>
667<p>Output only the last line of the <code>--stat</code> format containing total
668number of modified files, as well as number of added and deleted
669lines.</p>
670</dd>
671<dt class="hdlist1"><code>-X</code> [<em>&lt;param&gt;</em><code>,..</code>.]</dt>
672<dt class="hdlist1"><code>--dirstat</code>[<code>=</code><em>&lt;param&gt;</em><code>,..</code>.]</dt>
673<dd>
674<p>Output the distribution of relative amount of changes for each
675sub-directory. The behavior of <code>--dirstat</code> can be customized by
676passing it a comma separated list of parameters.
677The defaults are controlled by the <code>diff.dirstat</code> configuration
678variable (see <a href="git-config.html">git-config(1)</a>).
679The following parameters are available:</p>
680<div class="openblock">
681<div class="content">
682<div class="dlist">
683<dl>
684<dt class="hdlist1"><code>changes</code></dt>
685<dd>
686<p>Compute the dirstat numbers by counting the lines that have been
687removed from the source, or added to the destination. This ignores
688the amount of pure code movements within a file. In other words,
689rearranging lines in a file is not counted as much as other changes.
690This is the default behavior when no parameter is given.</p>
691</dd>
692<dt class="hdlist1"><code>lines</code></dt>
693<dd>
694<p>Compute the dirstat numbers by doing the regular line-based diff
695analysis, and summing the removed/added line counts. (For binary
696files, count 64-byte chunks instead, since binary files have no
697natural concept of lines). This is a more expensive <code>--dirstat</code>
698behavior than the <code>changes</code> behavior, but it does count rearranged
699lines within a file as much as other changes. The resulting output
Junio C Hamanoe03f5992025-04-23 22:24:29700is consistent with what you get from the other <code>--*stat</code> options.</p>
Junio C Hamano300c9262025-03-26 07:43:11701</dd>
702<dt class="hdlist1"><code>files</code></dt>
703<dd>
704<p>Compute the dirstat numbers by counting the number of files changed.
705Each changed file counts equally in the dirstat analysis. This is
706the computationally cheapest <code>--dirstat</code> behavior, since it does
707not have to look at the file contents at all.</p>
708</dd>
709<dt class="hdlist1"><code>cumulative</code></dt>
710<dd>
711<p>Count changes in a child directory for the parent directory as well.
712Note that when using <code>cumulative</code>, the sum of the percentages
713reported may exceed 100%. The default (non-cumulative) behavior can
714be specified with the <code>noncumulative</code> parameter.</p>
715</dd>
716<dt class="hdlist1"><em>&lt;limit&gt;</em></dt>
717<dd>
718<p>An integer parameter specifies a cut-off percent (3% by default).
719Directories contributing less than this percentage of the changes
720are not shown in the output.</p>
721</dd>
722</dl>
723</div>
724</div>
725</div>
726<div class="paragraph">
727<p>Example: The following will count changed files, while ignoring
728directories with less than 10% of the total amount of changed files,
729and accumulating child directory counts in the parent directories:
730<code>--dirstat=files,10,cumulative</code>.</p>
731</div>
732</dd>
733<dt class="hdlist1"><code>--cumulative</code></dt>
734<dd>
735<p>Synonym for <code>--dirstat=cumulative</code>.</p>
736</dd>
737<dt class="hdlist1"><code>--dirstat-by-file</code>[<code>=</code><em>&lt;param&gt;</em><code>,..</code>.]</dt>
738<dd>
739<p>Synonym for <code>--dirstat=files,</code><em>&lt;param&gt;</em><code>,..</code>..</p>
740</dd>
741<dt class="hdlist1"><code>--summary</code></dt>
742<dd>
743<p>Output a condensed summary of extended header information
744such as creations, renames and mode changes.</p>
745</dd>
746<dt class="hdlist1"><code>--patch-with-stat</code></dt>
747<dd>
748<p>Synonym for <code>-p</code> <code>--stat</code>.</p>
749</dd>
750<dt class="hdlist1"><code>-z</code></dt>
751<dd>
752<p>When <code>--raw</code>, <code>--numstat</code>, <code>--name-only</code> or <code>--name-status</code> has been
753given, do not munge pathnames and use NULs as output field terminators.</p>
754<div class="paragraph">
755<p>Without this option, pathnames with "unusual" characters are quoted as
756explained for the configuration variable <code>core.quotePath</code> (see
757<a href="git-config.html">git-config(1)</a>).</p>
758</div>
759</dd>
760<dt class="hdlist1"><code>--name-only</code></dt>
761<dd>
762<p>Show only the name of each changed file in the post-image tree.
763The file names are often encoded in UTF-8.
764For more information see the discussion about encoding in the <a href="git-log.html">git-log(1)</a>
765manual page.</p>
766</dd>
767<dt class="hdlist1"><code>--name-status</code></dt>
768<dd>
769<p>Show only the name(s) and status of each changed file. See the description
770of the <code>--diff-filter</code> option on what the status letters mean.
771Just like <code>--name-only</code> the file names are often encoded in UTF-8.</p>
772</dd>
773<dt class="hdlist1"><code>--submodule</code>[<code>=</code><em>&lt;format&gt;</em>]</dt>
774<dd>
775<p>Specify how differences in submodules are shown. When specifying
776<code>--submodule=short</code> the <code>short</code> format is used. This format just
777shows the names of the commits at the beginning and end of the range.
778When <code>--submodule</code> or <code>--submodule=log</code> is specified, the <code>log</code>
779format is used. This format lists the commits in the range like
780<a href="git-submodule.html">git-submodule(1)</a> <code>summary</code> does. When <code>--submodule=diff</code>
781is specified, the <code>diff</code> format is used. This format shows an
782inline diff of the changes in the submodule contents between the
783commit range. Defaults to <code>diff.submodule</code> or the <code>short</code> format
784if the config option is unset.</p>
785</dd>
786<dt class="hdlist1"><code>--color</code>[<code>=</code><em>&lt;when&gt;</em>]</dt>
787<dd>
788<p>Show colored diff.
789<code>--color</code> (i.e. without <code>=</code><em>&lt;when&gt;</em>) is the same as <code>--color=always</code>.
790<em>&lt;when&gt;</em> can be one of <code>always</code>, <code>never</code>, or <code>auto</code>.</p>
791</dd>
792<dt class="hdlist1"><code>--no-color</code></dt>
793<dd>
794<p>Turn off colored diff.
795It is the same as <code>--color=never</code>.</p>
796</dd>
797<dt class="hdlist1"><code>--color-moved</code>[<code>=</code><em>&lt;mode&gt;</em>]</dt>
798<dd>
799<p>Moved lines of code are colored differently.
800The <em>&lt;mode&gt;</em> defaults to <code>no</code> if the option is not given
801and to <code>zebra</code> if the option with no mode is given.
802The mode must be one of:</p>
803<div class="openblock">
804<div class="content">
805<div class="dlist">
806<dl>
807<dt class="hdlist1"><code>no</code></dt>
808<dd>
809<p>Moved lines are not highlighted.</p>
810</dd>
811<dt class="hdlist1"><code>default</code></dt>
812<dd>
813<p>Is a synonym for <code>zebra</code>. This may change to a more sensible mode
814in the future.</p>
815</dd>
816<dt class="hdlist1"><code>plain</code></dt>
817<dd>
818<p>Any line that is added in one location and was removed
819in another location will be colored with <code>color.diff.newMoved</code>.
820Similarly <code>color.diff.oldMoved</code> will be used for removed lines
821that are added somewhere else in the diff. This mode picks up any
822moved line, but it is not very useful in a review to determine
823if a block of code was moved without permutation.</p>
824</dd>
825<dt class="hdlist1"><code>blocks</code></dt>
826<dd>
827<p>Blocks of moved text of at least 20 alphanumeric characters
828are detected greedily. The detected blocks are
829painted using either the <code>color.diff.</code>(<code>old</code>|<code>new</code>)<code>Moved</code> color.
830Adjacent blocks cannot be told apart.</p>
831</dd>
832<dt class="hdlist1"><code>zebra</code></dt>
833<dd>
834<p>Blocks of moved text are detected as in <code>blocks</code> mode. The blocks
835are painted using either the <code>color.diff.</code>(<code>old</code>|<code>new</code>)<code>Moved</code> color or
836<code>color.diff.</code>(<code>old</code>|<code>new</code>)<code>MovedAlternative</code>. The change between
837the two colors indicates that a new block was detected.</p>
838</dd>
839<dt class="hdlist1"><code>dimmed-zebra</code></dt>
840<dd>
841<p>Similar to <code>zebra</code>, but additional dimming of uninteresting parts
842of moved code is performed. The bordering lines of two adjacent
843blocks are considered interesting, the rest is uninteresting.
844<code>dimmed_zebra</code> is a deprecated synonym.</p>
845</dd>
846</dl>
847</div>
848</div>
849</div>
850</dd>
851<dt class="hdlist1"><code>--no-color-moved</code></dt>
852<dd>
853<p>Turn off move detection. This can be used to override configuration
854settings. It is the same as <code>--color-moved=no</code>.</p>
855</dd>
856<dt class="hdlist1"><code>--color-moved-ws=</code><em>&lt;mode&gt;</em><code>,..</code>.</dt>
857<dd>
858<p>This configures how whitespace is ignored when performing the
859move detection for <code>--color-moved</code>.
860These modes can be given as a comma separated list:</p>
861<div class="openblock">
862<div class="content">
863<div class="dlist">
864<dl>
865<dt class="hdlist1"><code>no</code></dt>
866<dd>
867<p>Do not ignore whitespace when performing move detection.</p>
868</dd>
869<dt class="hdlist1"><code>ignore-space-at-eol</code></dt>
870<dd>
871<p>Ignore changes in whitespace at EOL.</p>
872</dd>
873<dt class="hdlist1"><code>ignore-space-change</code></dt>
874<dd>
875<p>Ignore changes in amount of whitespace. This ignores whitespace
876at line end, and considers all other sequences of one or
877more whitespace characters to be equivalent.</p>
878</dd>
879<dt class="hdlist1"><code>ignore-all-space</code></dt>
880<dd>
881<p>Ignore whitespace when comparing lines. This ignores differences
882even if one line has whitespace where the other line has none.</p>
883</dd>
884<dt class="hdlist1"><code>allow-indentation-change</code></dt>
885<dd>
886<p>Initially ignore any whitespace in the move detection, then
887group the moved code blocks only into a block if the change in
888whitespace is the same per line. This is incompatible with the
889other modes.</p>
890</dd>
891</dl>
892</div>
893</div>
894</div>
895</dd>
896<dt class="hdlist1"><code>--no-color-moved-ws</code></dt>
897<dd>
898<p>Do not ignore whitespace when performing move detection. This can be
899used to override configuration settings. It is the same as
900<code>--color-moved-ws=no</code>.</p>
901</dd>
902<dt class="hdlist1"><code>--word-diff</code>[<code>=</code><em>&lt;mode&gt;</em>]</dt>
903<dd>
904<p>By default, words are delimited by whitespace; see
905<code>--word-diff-regex</code> below. The <em>&lt;mode&gt;</em> defaults to <code>plain</code>, and
906must be one of:</p>
907<div class="openblock">
908<div class="content">
909<div class="dlist">
910<dl>
911<dt class="hdlist1"><code>color</code></dt>
912<dd>
913<p>Highlight changed words using only colors. Implies <code>--color</code>.</p>
914</dd>
915<dt class="hdlist1"><code>plain</code></dt>
916<dd>
917<p>Show words as [<code>-removed-</code>] and {<code>added</code>}. Makes no
918attempts to escape the delimiters if they appear in the input,
919so the output may be ambiguous.</p>
920</dd>
921<dt class="hdlist1"><code>porcelain</code></dt>
922<dd>
923<p>Use a special line-based format intended for script
924consumption. Added/removed/unchanged runs are printed in the
925usual unified diff format, starting with a <code>+</code>/<code>-</code>/` `
926character at the beginning of the line and extending to the
927end of the line. Newlines in the input are represented by a
928tilde <code>~</code> on a line of its own.</p>
929</dd>
930<dt class="hdlist1"><code>none</code></dt>
931<dd>
932<p>Disable word diff again.</p>
933</dd>
934</dl>
935</div>
936</div>
937</div>
938<div class="paragraph">
939<p>Note that despite the name of the first mode, color is used to
940highlight the changed parts in all modes if enabled.</p>
941</div>
942</dd>
943<dt class="hdlist1"><code>--word-diff-regex=</code><em>&lt;regex&gt;</em></dt>
944<dd>
945<p>Use <em>&lt;regex&gt;</em> to decide what a word is, instead of considering
946runs of non-whitespace to be a word. Also implies
947<code>--word-diff</code> unless it was already enabled.</p>
948<div class="paragraph">
949<p>Every non-overlapping match of the
950<em>&lt;regex&gt;</em> is considered a word. Anything between these matches is
951considered whitespace and ignored(!) for the purposes of finding
952differences. You may want to append |[<code>^</code>[<code>:space:</code>]] to your regular
953expression to make sure that it matches all non-whitespace characters.
954A match that contains a newline is silently truncated(!) at the
955newline.</p>
956</div>
957<div class="paragraph">
958<p>For example, <code>--word-diff-regex=.</code> will treat each character as a word
959and, correspondingly, show differences character by character.</p>
960</div>
961<div class="paragraph">
962<p>The regex can also be set via a diff driver or configuration option, see
963<a href="gitattributes.html">gitattributes(5)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly
964overrides any diff driver or configuration setting. Diff drivers
965override configuration settings.</p>
966</div>
967</dd>
968<dt class="hdlist1"><code>--color-words</code>[<code>=</code><em>&lt;regex&gt;</em>]</dt>
969<dd>
970<p>Equivalent to <code>--word-diff=color</code> plus (if a regex was
971specified) <code>--word-diff-regex=</code><em>&lt;regex&gt;</em>.</p>
972</dd>
973<dt class="hdlist1"><code>--no-renames</code></dt>
974<dd>
975<p>Turn off rename detection, even when the configuration
976file gives the default to do so.</p>
977</dd>
978<dt class="hdlist1"><code>--</code>[<code>no-</code>]<code>rename-empty</code></dt>
979<dd>
980<p>Whether to use empty blobs as rename source.</p>
981</dd>
982<dt class="hdlist1"><code>--check</code></dt>
983<dd>
984<p>Warn if changes introduce conflict markers or whitespace errors.
985What are considered whitespace errors is controlled by <code>core.whitespace</code>
986configuration. By default, trailing whitespaces (including
987lines that consist solely of whitespaces) and a space character
988that is immediately followed by a tab character inside the
989initial indent of the line are considered whitespace errors.
990Exits with non-zero status if problems are found. Not compatible
991with <code>--exit-code</code>.</p>
992</dd>
993<dt class="hdlist1"><code>--ws-error-highlight=</code><em>&lt;kind&gt;</em></dt>
994<dd>
995<p>Highlight whitespace errors in the <code>context</code>, <code>old</code> or <code>new</code>
996lines of the diff. Multiple values are separated by comma,
997<code>none</code> resets previous values, <code>default</code> reset the list to
998<code>new</code> and <code>all</code> is a shorthand for <code>old,new,context</code>. When
999this option is not given, and the configuration variable
1000<code>diff.wsErrorHighlight</code> is not set, only whitespace errors in
1001<code>new</code> lines are highlighted. The whitespace errors are colored
1002with <code>color.diff.whitespace</code>.</p>
1003</dd>
1004<dt class="hdlist1"><code>--full-index</code></dt>
1005<dd>
1006<p>Instead of the first handful of characters, show the full
1007pre- and post-image blob object names on the "index"
1008line when generating patch format output.</p>
1009</dd>
1010<dt class="hdlist1"><code>--binary</code></dt>
1011<dd>
1012<p>In addition to <code>--full-index</code>, output a binary diff that
1013can be applied with <code>git-apply</code>.
1014Implies <code>--patch</code>.</p>
1015</dd>
1016<dt class="hdlist1"><code>--abbrev</code>[<code>=</code><em>&lt;n&gt;</em>]</dt>
1017<dd>
1018<p>Instead of showing the full 40-byte hexadecimal object
1019name in diff-raw format output and diff-tree header
1020lines, show the shortest prefix that is at least <em>&lt;n&gt;</em>
1021hexdigits long that uniquely refers the object.
1022In diff-patch output format, <code>--full-index</code> takes higher
1023precedence, i.e. if <code>--full-index</code> is specified, full blob
1024names will be shown regardless of <code>--abbrev</code>.
1025Non default number of digits can be specified with <code>--abbrev=</code><em>&lt;n&gt;</em>.</p>
1026</dd>
1027<dt class="hdlist1"><code>-B</code>[<em>&lt;n&gt;</em>][<code>/</code><em>&lt;m&gt;</em>]</dt>
1028<dt class="hdlist1"><code>--break-rewrites</code>[<code>=</code>[<em>&lt;n&gt;</em>][<code>/</code><em>&lt;m&gt;</em>]]</dt>
1029<dd>
1030<p>Break complete rewrite changes into pairs of delete and
1031create. This serves two purposes:</p>
1032<div class="paragraph">
1033<p>It affects the way a change that amounts to a total rewrite of a file
1034not as a series of deletion and insertion mixed together with a very
1035few lines that happen to match textually as the context, but as a
1036single deletion of everything old followed by a single insertion of
1037everything new, and the number <em>&lt;m&gt;</em> controls this aspect of the <code>-B</code>
1038option (defaults to 60%). <code>-B/70</code>% specifies that less than 30% of the
1039original should remain in the result for Git to consider it a total
1040rewrite (i.e. otherwise the resulting patch will be a series of
1041deletion and insertion mixed together with context lines).</p>
1042</div>
1043<div class="paragraph">
1044<p>When used with <code>-M</code>, a totally-rewritten file is also considered as the
1045source of a rename (usually <code>-M</code> only considers a file that disappeared
1046as the source of a rename), and the number <em>&lt;n&gt;</em> controls this aspect of
1047the <code>-B</code> option (defaults to 50%). <code>-B20</code>% specifies that a change with
1048addition and deletion compared to 20% or more of the file&#8217;s size are
1049eligible for being picked up as a possible source of a rename to
1050another file.</p>
1051</div>
1052</dd>
1053<dt class="hdlist1"><code>-M</code>[<em>&lt;n&gt;</em>]</dt>
1054<dt class="hdlist1"><code>--find-renames</code>[<code>=</code><em>&lt;n&gt;</em>]</dt>
1055<dd>
1056<p>Detect renames.
1057If <em>&lt;n&gt;</em> is specified, it is a threshold on the similarity
1058index (i.e. amount of addition/deletions compared to the
1059file&#8217;s size). For example, <code>-M90</code>% means Git should consider a
1060delete/add pair to be a rename if more than 90% of the file
1061hasn&#8217;t changed. Without a % sign, the number is to be read as
1062a fraction, with a decimal point before it. I.e., <code>-M5</code> becomes
10630.5, and is thus the same as <code>-M50</code>%. Similarly, <code>-M05</code> is
1064the same as <code>-M5</code>%. To limit detection to exact renames, use
1065<code>-M100</code>%. The default similarity index is 50%.</p>
1066</dd>
1067<dt class="hdlist1"><code>-C</code>[<em>&lt;n&gt;</em>]</dt>
1068<dt class="hdlist1"><code>--find-copies</code>[<code>=</code><em>&lt;n&gt;</em>]</dt>
1069<dd>
1070<p>Detect copies as well as renames. See also <code>--find-copies-harder</code>.
1071If <em>&lt;n&gt;</em> is specified, it has the same meaning as for <code>-M</code><em>&lt;n&gt;</em>.</p>
1072</dd>
1073<dt class="hdlist1"><code>--find-copies-harder</code></dt>
1074<dd>
1075<p>For performance reasons, by default, <code>-C</code> option finds copies only
1076if the original file of the copy was modified in the same
1077changeset. This flag makes the command
1078inspect unmodified files as candidates for the source of
1079copy. This is a very expensive operation for large
1080projects, so use it with caution. Giving more than one
1081<code>-C</code> option has the same effect.</p>
1082</dd>
1083<dt class="hdlist1"><code>-D</code></dt>
1084<dt class="hdlist1"><code>--irreversible-delete</code></dt>
1085<dd>
1086<p>Omit the preimage for deletes, i.e. print only the header but not
1087the diff between the preimage and <code>/dev/null</code>. The resulting patch
1088is not meant to be applied with <code>patch</code> or <code>git</code> <code>apply</code>; this is
1089solely for people who want to just concentrate on reviewing the
1090text after the change. In addition, the output obviously lacks
1091enough information to apply such a patch in reverse, even manually,
1092hence the name of the option.</p>
1093<div class="paragraph">
1094<p>When used together with <code>-B</code>, omit also the preimage in the deletion part
1095of a delete/create pair.</p>
1096</div>
1097</dd>
1098<dt class="hdlist1"><code>-l</code><em>&lt;num&gt;</em></dt>
1099<dd>
1100<p>The <code>-M</code> and <code>-C</code> options involve some preliminary steps that
1101can detect subsets of renames/copies cheaply, followed by an
1102exhaustive fallback portion that compares all remaining
1103unpaired destinations to all relevant sources. (For renames,
1104only remaining unpaired sources are relevant; for copies, all
1105original sources are relevant.) For N sources and
1106destinations, this exhaustive check is O(N^2). This option
1107prevents the exhaustive portion of rename/copy detection from
1108running if the number of source/destination files involved
1109exceeds the specified number. Defaults to <code>diff.renameLimit</code>.
1110Note that a value of 0 is treated as unlimited.</p>
1111</dd>
Junio C Hamanoe03f5992025-04-23 22:24:291112<dt class="hdlist1"><code>--diff-filter=</code>[(<code>A</code>|<code>C</code>|<code>D</code>|<code>M</code>|<code>R</code>|<code>T</code>|<code>U</code>|<code>X</code>|<code>B</code>)<code>...</code>[<code>*</code>]]</dt>
Junio C Hamano300c9262025-03-26 07:43:111113<dd>
1114<p>Select only files that are Added (<code>A</code>), Copied (<code>C</code>),
1115Deleted (<code>D</code>), Modified (<code>M</code>), Renamed (<code>R</code>), have their
1116type (i.e. regular file, symlink, submodule, &#8230;&#8203;) changed (<code>T</code>),
1117are Unmerged (<code>U</code>), are
1118Unknown (<code>X</code>), or have had their pairing Broken (<code>B</code>).
1119Any combination of the filter characters (including none) can be used.
Junio C Hamanoe03f5992025-04-23 22:24:291120When <code>*</code> (All-or-none) is added to the combination, all
Junio C Hamano300c9262025-03-26 07:43:111121paths are selected if there is any file that matches
1122other criteria in the comparison; if there is no file
1123that matches other criteria, nothing is selected.</p>
1124<div class="paragraph">
1125<p>Also, these upper-case letters can be downcased to exclude. E.g.
1126<code>--diff-filter=ad</code> excludes added and deleted paths.</p>
1127</div>
1128<div class="paragraph">
1129<p>Note that not all diffs can feature all types. For instance, copied and
1130renamed entries cannot appear if detection for those types is disabled.</p>
1131</div>
1132</dd>
1133<dt class="hdlist1"><code>-S</code><em>&lt;string&gt;</em></dt>
1134<dd>
1135<p>Look for differences that change the number of occurrences of
1136the specified <em>&lt;string&gt;</em> (i.e. addition/deletion) in a file.
1137Intended for the scripter&#8217;s use.</p>
1138<div class="paragraph">
1139<p>It is useful when you&#8217;re looking for an exact block of code (like a
1140struct), and want to know the history of that block since it first
1141came into being: use the feature iteratively to feed the interesting
1142block in the preimage back into <code>-S</code>, and keep going until you get the
1143very first version of the block.</p>
1144</div>
1145<div class="paragraph">
1146<p>Binary files are searched as well.</p>
1147</div>
1148</dd>
1149<dt class="hdlist1"><code>-G</code><em>&lt;regex&gt;</em></dt>
1150<dd>
1151<p>Look for differences whose patch text contains added/removed
1152lines that match <em>&lt;regex&gt;</em>.</p>
1153<div class="paragraph">
1154<p>To illustrate the difference between <code>-S</code><em>&lt;regex&gt;</em> <code>--pickaxe-regex</code> and
1155<code>-G</code><em>&lt;regex&gt;</em>, consider a commit with the following diff in the same
1156file:</p>
1157</div>
1158<div class="listingblock">
1159<div class="content">
1160<pre>+ return frotz(nitfol, two-&gt;ptr, 1, 0);
1161...
1162- hit = frotz(nitfol, mf2.ptr, 1, 0);</pre>
1163</div>
1164</div>
1165<div class="paragraph">
1166<p>While <code>git</code> <code>log</code> <code>-G</code>"frotz\(<code>nitfol</code>" will show this commit, <code>git</code> <code>log</code>
1167<code>-S</code>"frotz\(<code>nitfol</code>" <code>--pickaxe-regex</code> will not (because the number of
1168occurrences of that string did not change).</p>
1169</div>
1170<div class="paragraph">
1171<p>Unless <code>--text</code> is supplied patches of binary files without a textconv
1172filter will be ignored.</p>
1173</div>
1174<div class="paragraph">
1175<p>See the <em>pickaxe</em> entry in <a href="gitdiffcore.html">gitdiffcore(7)</a> for more
1176information.</p>
1177</div>
1178</dd>
1179<dt class="hdlist1"><code>--find-object=</code><em>&lt;object-id&gt;</em></dt>
1180<dd>
1181<p>Look for differences that change the number of occurrences of
1182the specified object. Similar to <code>-S</code>, just the argument is different
1183in that it doesn&#8217;t search for a specific string but for a specific
1184object id.</p>
1185<div class="paragraph">
1186<p>The object can be a blob or a submodule commit. It implies the <code>-t</code> option in
1187<code>git-log</code> to also find trees.</p>
1188</div>
1189</dd>
1190<dt class="hdlist1"><code>--pickaxe-all</code></dt>
1191<dd>
1192<p>When <code>-S</code> or <code>-G</code> finds a change, show all the changes in that
1193changeset, not just the files that contain the change
1194in <em>&lt;string&gt;</em>.</p>
1195</dd>
1196<dt class="hdlist1"><code>--pickaxe-regex</code></dt>
1197<dd>
1198<p>Treat the <em>&lt;string&gt;</em> given to <code>-S</code> as an extended POSIX regular
1199expression to match.</p>
1200</dd>
1201<dt class="hdlist1"><code>-O</code><em>&lt;orderfile&gt;</em></dt>
1202<dd>
1203<p>Control the order in which files appear in the output.
1204This overrides the <code>diff.orderFile</code> configuration variable
1205(see <a href="git-config.html">git-config(1)</a>). To cancel <code>diff.orderFile</code>,
1206use <code>-O/dev/null</code>.</p>
1207<div class="paragraph">
1208<p>The output order is determined by the order of glob patterns in
1209<em>&lt;orderfile&gt;</em>.
1210All files with pathnames that match the first pattern are output
1211first, all files with pathnames that match the second pattern (but not
1212the first) are output next, and so on.
1213All files with pathnames that do not match any pattern are output
1214last, as if there was an implicit match-all pattern at the end of the
1215file.
1216If multiple pathnames have the same rank (they match the same pattern
1217but no earlier patterns), their output order relative to each other is
1218the normal order.</p>
1219</div>
1220<div class="paragraph">
1221<p><em>&lt;orderfile&gt;</em> is parsed as follows:</p>
1222</div>
1223<div class="openblock">
1224<div class="content">
1225<div class="ulist">
1226<ul>
1227<li>
1228<p>Blank lines are ignored, so they can be used as separators for
1229readability.</p>
1230</li>
1231<li>
1232<p>Lines starting with a hash ("#") are ignored, so they can be used
Junio C Hamanoe03f5992025-04-23 22:24:291233for comments. Add a backslash ("<code>\</code>") to the beginning of the
Junio C Hamano300c9262025-03-26 07:43:111234pattern if it starts with a hash.</p>
1235</li>
1236<li>
1237<p>Each other line contains a single pattern.</p>
1238</li>
1239</ul>
1240</div>
1241</div>
1242</div>
1243<div class="paragraph">
1244<p>Patterns have the same syntax and semantics as patterns used for
1245<code>fnmatch</code>(3) without the <code>FNM_PATHNAME</code> flag, except a pathname also
1246matches a pattern if removing any number of the final pathname
Junio C Hamanoe03f5992025-04-23 22:24:291247components matches the pattern. For example, the pattern "<code>foo*bar</code>"
Junio C Hamano300c9262025-03-26 07:43:111248matches "<code>fooasdfbar</code>" and "<code>foo/bar/baz/asdf</code>" but not "<code>foobarx</code>".</p>
1249</div>
1250</dd>
1251<dt class="hdlist1"><code>--skip-to=</code><em>&lt;file&gt;</em></dt>
1252<dt class="hdlist1"><code>--rotate-to=</code><em>&lt;file&gt;</em></dt>
1253<dd>
1254<p>Discard the files before the named <em>&lt;file&gt;</em> from the output
1255(i.e. <em>skip to</em>), or move them to the end of the output
1256(i.e. <em>rotate to</em>). These options were invented primarily for the use
1257of the <code>git</code> <code>difftool</code> command, and may not be very useful
1258otherwise.</p>
1259</dd>
1260<dt class="hdlist1"><code>-R</code></dt>
1261<dd>
1262<p>Swap two inputs; that is, show differences from index or
1263on-disk file to tree contents.</p>
1264</dd>
1265<dt class="hdlist1"><code>--relative</code>[<code>=</code><em>&lt;path&gt;</em>]</dt>
1266<dt class="hdlist1"><code>--no-relative</code></dt>
1267<dd>
1268<p>When run from a subdirectory of the project, it can be
1269told to exclude changes outside the directory and show
1270pathnames relative to it with this option. When you are
1271not in a subdirectory (e.g. in a bare repository), you
1272can name which subdirectory to make the output relative
1273to by giving a <em>&lt;path&gt;</em> as an argument.
1274<code>--no-relative</code> can be used to countermand both <code>diff.relative</code> config
1275option and previous <code>--relative</code>.</p>
1276</dd>
1277<dt class="hdlist1"><code>-a</code></dt>
1278<dt class="hdlist1"><code>--text</code></dt>
1279<dd>
1280<p>Treat all files as text.</p>
1281</dd>
1282<dt class="hdlist1"><code>--ignore-cr-at-eol</code></dt>
1283<dd>
1284<p>Ignore carriage-return at the end of line when doing a comparison.</p>
1285</dd>
1286<dt class="hdlist1"><code>--ignore-space-at-eol</code></dt>
1287<dd>
1288<p>Ignore changes in whitespace at EOL.</p>
1289</dd>
1290<dt class="hdlist1"><code>-b</code></dt>
1291<dt class="hdlist1"><code>--ignore-space-change</code></dt>
1292<dd>
1293<p>Ignore changes in amount of whitespace. This ignores whitespace
1294at line end, and considers all other sequences of one or
1295more whitespace characters to be equivalent.</p>
1296</dd>
1297<dt class="hdlist1"><code>-w</code></dt>
1298<dt class="hdlist1"><code>--ignore-all-space</code></dt>
1299<dd>
1300<p>Ignore whitespace when comparing lines. This ignores
1301differences even if one line has whitespace where the other
1302line has none.</p>
1303</dd>
1304<dt class="hdlist1"><code>--ignore-blank-lines</code></dt>
1305<dd>
1306<p>Ignore changes whose lines are all blank.</p>
1307</dd>
1308<dt class="hdlist1"><code>-I</code><em>&lt;regex&gt;</em></dt>
1309<dt class="hdlist1"><code>--ignore-matching-lines=</code><em>&lt;regex&gt;</em></dt>
1310<dd>
1311<p>Ignore changes whose all lines match <em>&lt;regex&gt;</em>. This option may
1312be specified more than once.</p>
1313</dd>
1314<dt class="hdlist1"><code>--inter-hunk-context=</code><em>&lt;number&gt;</em></dt>
1315<dd>
1316<p>Show the context between diff hunks, up to the specified <em>&lt;number&gt;</em>
1317of lines, thereby fusing hunks that are close to each other.
1318Defaults to <code>diff.interHunkContext</code> or 0 if the config option
1319is unset.</p>
1320</dd>
1321<dt class="hdlist1"><code>-W</code></dt>
1322<dt class="hdlist1"><code>--function-context</code></dt>
1323<dd>
1324<p>Show whole function as context lines for each change.
1325The function names are determined in the same way as
1326<code>git</code> <code>diff</code> works out patch hunk headers (see "Defining a
1327custom hunk-header" in <a href="gitattributes.html">gitattributes(5)</a>).</p>
1328</dd>
1329<dt class="hdlist1"><code>--exit-code</code></dt>
1330<dd>
1331<p>Make the program exit with codes similar to <code>diff</code>(1).
1332That is, it exits with 1 if there were differences and
13330 means no differences.</p>
1334</dd>
1335<dt class="hdlist1"><code>--quiet</code></dt>
1336<dd>
1337<p>Disable all output of the program. Implies <code>--exit-code</code>.
1338Disables execution of external diff helpers whose exit code
1339is not trusted, i.e. their respective configuration option
1340<code>diff.trustExitCode</code> or <code>diff.</code><em>&lt;driver&gt;</em>.<code>trustExitCode</code> or
1341environment variable <code>GIT_EXTERNAL_DIFF_TRUST_EXIT_CODE</code> is
1342false.</p>
1343</dd>
1344<dt class="hdlist1"><code>--ext-diff</code></dt>
1345<dd>
1346<p>Allow an external diff helper to be executed. If you set an
1347external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1348to use this option with <a href="git-log.html">git-log(1)</a> and friends.</p>
1349</dd>
1350<dt class="hdlist1"><code>--no-ext-diff</code></dt>
1351<dd>
1352<p>Disallow external diff drivers.</p>
1353</dd>
1354<dt class="hdlist1"><code>--textconv</code></dt>
1355<dt class="hdlist1"><code>--no-textconv</code></dt>
1356<dd>
1357<p>Allow (or disallow) external text conversion filters to be run
1358when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for
1359details. Because textconv filters are typically a one-way
1360conversion, the resulting diff is suitable for human
1361consumption, but cannot be applied. For this reason, textconv
1362filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and
1363<a href="git-log.html">git-log(1)</a>, but not for <a href="git-format-patch.html">git-format-patch(1)</a> or
1364diff plumbing commands.</p>
1365</dd>
1366<dt class="hdlist1"><code>--ignore-submodules</code>[<code>=</code>(<code>none</code>|<code>untracked</code>|<code>dirty</code>|<code>all</code>)]</dt>
1367<dd>
1368<p>Ignore changes to submodules in the diff generation. <code>all</code> is the default.
1369Using <code>none</code> will consider the submodule modified when it either contains
1370untracked or modified files or its <code>HEAD</code> differs from the commit recorded
1371in the superproject and can be used to override any settings of the
1372<code>ignore</code> option in <a href="git-config.html">git-config(1)</a> or <a href="gitmodules.html">gitmodules(5)</a>. When
1373<code>untracked</code> is used submodules are not considered dirty when they only
1374contain untracked content (but they are still scanned for modified
1375content). Using <code>dirty</code> ignores all changes to the work tree of submodules,
1376only changes to the commits stored in the superproject are shown (this was
1377the behavior until 1.7.0). Using <code>all</code> hides all changes to submodules.</p>
1378</dd>
1379<dt class="hdlist1"><code>--src-prefix=</code><em>&lt;prefix&gt;</em></dt>
1380<dd>
1381<p>Show the given source <em>&lt;prefix&gt;</em> instead of "a/".</p>
1382</dd>
1383<dt class="hdlist1"><code>--dst-prefix=</code><em>&lt;prefix&gt;</em></dt>
1384<dd>
1385<p>Show the given destination <em>&lt;prefix&gt;</em> instead of "b/".</p>
1386</dd>
1387<dt class="hdlist1"><code>--no-prefix</code></dt>
1388<dd>
1389<p>Do not show any source or destination prefix.</p>
1390</dd>
1391<dt class="hdlist1"><code>--default-prefix</code></dt>
1392<dd>
1393<p>Use the default source and destination prefixes ("a/" and "b/").
1394This overrides configuration variables such as <code>diff.noprefix</code>,
1395<code>diff.srcPrefix</code>, <code>diff.dstPrefix</code>, and <code>diff.mnemonicPrefix</code>
1396(see <a href="git-config.html">git-config(1)</a>).</p>
1397</dd>
1398<dt class="hdlist1"><code>--line-prefix=</code><em>&lt;prefix&gt;</em></dt>
1399<dd>
1400<p>Prepend an additional <em>&lt;prefix&gt;</em> to every line of output.</p>
1401</dd>
1402<dt class="hdlist1"><code>--ita-invisible-in-index</code></dt>
1403<dd>
1404<p>By default entries added by <code>git</code> <code>add</code> <code>-N</code> appear as an existing
1405empty file in <code>git</code> <code>diff</code> and a new file in <code>git</code> <code>diff</code> <code>--cached</code>.
1406This option makes the entry appear as a new file in <code>git</code> <code>diff</code>
1407and non-existent in <code>git</code> <code>diff</code> <code>--cached</code>. This option could be
1408reverted with <code>--ita-visible-in-index</code>. Both options are
1409experimental and could be removed in future.</p>
1410</dd>
1411</dl>
1412</div>
1413<div class="paragraph">
1414<p>For more detailed explanation on these common options, see also
1415<a href="gitdiffcore.html">gitdiffcore(7)</a>.</p>
1416</div>
1417</div>
1418</div>
1419<div class="sect1">
1420<h2 id="generate_patch_text_with_p">Generating patch text with -p</h2>
1421<div class="sectionbody">
1422<div class="paragraph">
1423<p>Running
1424<a href="git-diff.html">git-diff(1)</a>,
1425<a href="git-log.html">git-log(1)</a>,
1426<a href="git-show.html">git-show(1)</a>,
1427<a href="git-diff-index.html">git-diff-index(1)</a>,
1428<a href="git-diff-tree.html">git-diff-tree(1)</a>, or
1429<a href="git-diff-files.html">git-diff-files(1)</a>
1430with the <code>-p</code> option produces patch text.
1431You can customize the creation of patch text via the
1432<code>GIT_EXTERNAL_DIFF</code> and the <code>GIT_DIFF_OPTS</code> environment variables
1433(see <a href="git.html">git(1)</a>), and the <code>diff</code> attribute (see <a href="gitattributes.html">gitattributes(5)</a>).</p>
1434</div>
1435<div class="paragraph">
1436<p>What the <code>-p</code> option produces is slightly different from the traditional
1437diff format:</p>
1438</div>
1439<div class="olist arabic">
1440<ol class="arabic">
1441<li>
1442<p>It is preceded by a "git diff" header that looks like this:</p>
1443<div class="literalblock">
1444<div class="content">
1445<pre>diff --git a/file1 b/file2</pre>
1446</div>
1447</div>
1448<div class="paragraph">
1449<p>The <code>a/</code> and <code>b/</code> filenames are the same unless rename/copy is
1450involved. Especially, even for a creation or a deletion,
1451<code>/dev/null</code> is <em>not</em> used in place of the <code>a/</code> or <code>b/</code> filenames.</p>
1452</div>
1453<div class="paragraph">
1454<p>When a rename/copy is involved, <code>file1</code> and <code>file2</code> show the
1455name of the source file of the rename/copy and the name of
1456the file that the rename/copy produces, respectively.</p>
1457</div>
1458</li>
1459<li>
1460<p>It is followed by one or more extended header lines:</p>
1461<div class="verseblock">
1462<pre class="content"><code>old</code> <code>mode</code> <em>&lt;mode&gt;</em>
1463<code>new</code> <code>mode</code> <em>&lt;mode&gt;</em>
1464<code>deleted</code> <code>file</code> <code>mode</code> <em>&lt;mode&gt;</em>
1465<code>new</code> <code>file</code> <code>mode</code> <em>&lt;mode&gt;</em>
1466<code>copy</code> <code>from</code> <em>&lt;path&gt;</em>
1467<code>copy</code> <code>to</code> <em>&lt;path&gt;</em>
1468<code>rename</code> <code>from</code> <em>&lt;path&gt;</em>
1469<code>rename</code> <code>to</code> <em>&lt;path&gt;</em>
1470<code>similarity</code> <code>index</code> <em>&lt;number&gt;</em>
1471<code>dissimilarity</code> <code>index</code> <em>&lt;number&gt;</em>
Junio C Hamanoe03f5992025-04-23 22:24:291472<code>index</code> <em>&lt;hash&gt;</em><code>..</code><em>&lt;hash&gt;</em> <em>&lt;mode&gt;</em></pre>
Junio C Hamano300c9262025-03-26 07:43:111473</div>
1474<div class="paragraph">
1475<p>File modes <em>&lt;mode&gt;</em> are printed as 6-digit octal numbers including the file type
1476and file permission bits.</p>
1477</div>
1478<div class="paragraph">
1479<p>Path names in extended headers do not include the <code>a/</code> and <code>b/</code> prefixes.</p>
1480</div>
1481<div class="paragraph">
1482<p>The similarity index is the percentage of unchanged lines, and
1483the dissimilarity index is the percentage of changed lines. It
1484is a rounded down integer, followed by a percent sign. The
1485similarity index value of 100% is thus reserved for two equal
1486files, while 100% dissimilarity means that no line from the old
1487file made it into the new one.</p>
1488</div>
1489<div class="paragraph">
1490<p>The index line includes the blob object names before and after the change.
1491The <em>&lt;mode&gt;</em> is included if the file mode does not change; otherwise,
1492separate lines indicate the old and the new mode.</p>
1493</div>
1494</li>
1495<li>
1496<p>Pathnames with "unusual" characters are quoted as explained for
1497the configuration variable <code>core.quotePath</code> (see
1498<a href="git-config.html">git-config(1)</a>).</p>
1499</li>
1500<li>
1501<p>All the <code>file1</code> files in the output refer to files before the
1502commit, and all the <code>file2</code> files refer to files after the commit.
1503It is incorrect to apply each change to each file sequentially. For
1504example, this patch will swap a and b:</p>
1505<div class="literalblock">
1506<div class="content">
1507<pre>diff --git a/a b/b
1508rename from a
1509rename to b
1510diff --git a/b b/a
1511rename from b
1512rename to a</pre>
1513</div>
1514</div>
1515</li>
1516<li>
1517<p>Hunk headers mention the name of the function to which the hunk
1518applies. See "Defining a custom hunk-header" in
1519<a href="gitattributes.html">gitattributes(5)</a> for details of how to tailor this to
1520specific languages.</p>
1521</li>
1522</ol>
1523</div>
1524</div>
1525</div>
1526<div class="sect1">
1527<h2 id="_combined_diff_format">Combined diff format</h2>
1528<div class="sectionbody">
1529<div class="paragraph">
1530<p>Any diff-generating command can take the <code>-c</code> or <code>--cc</code> option to
1531produce a <em>combined diff</em> when showing a merge. This is the default
1532format when showing merges with <a href="git-diff.html">git-diff(1)</a> or
1533<a href="git-show.html">git-show(1)</a>. Note also that you can give suitable
1534<code>--diff-merges</code> option to any of these commands to force generation of
1535diffs in a specific format.</p>
1536</div>
1537<div class="paragraph">
1538<p>A "combined diff" format looks like this:</p>
1539</div>
1540<div class="listingblock">
1541<div class="content">
1542<pre>diff --combined describe.c
1543index fabadb8,cc95eb0..4866510
1544--- a/describe.c
1545+++ b/describe.c
1546@@@ -98,20 -98,12 +98,20 @@@
1547 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
1548 }
1549
1550- static void describe(char *arg)
1551 -static void describe(struct commit *cmit, int last_one)
1552++static void describe(char *arg, int last_one)
1553 {
1554 + unsigned char sha1[20];
1555 + struct commit *cmit;
1556 struct commit_list *list;
1557 static int initialized = 0;
1558 struct commit_name *n;
1559
1560 + if (get_sha1(arg, sha1) &lt; 0)
1561 + usage(describe_usage);
1562 + cmit = lookup_commit_reference(sha1);
1563 + if (!cmit)
1564 + usage(describe_usage);
1565 +
1566 if (!initialized) {
1567 initialized = 1;
1568 for_each_ref(get_name);</pre>
1569</div>
1570</div>
1571<div class="olist arabic">
1572<ol class="arabic">
1573<li>
1574<p>It is preceded by a "git diff" header, that looks like
1575this (when the <code>-c</code> option is used):</p>
1576<div class="literalblock">
1577<div class="content">
1578<pre>diff --combined file</pre>
1579</div>
1580</div>
1581<div class="paragraph">
1582<p>or like this (when the <code>--cc</code> option is used):</p>
1583</div>
1584<div class="literalblock">
1585<div class="content">
1586<pre>diff --cc file</pre>
1587</div>
1588</div>
1589</li>
1590<li>
1591<p>It is followed by one or more extended header lines
1592(this example shows a merge with two parents):</p>
1593<div class="verseblock">
Junio C Hamanoe03f5992025-04-23 22:24:291594<pre class="content"><code>index</code> <em>&lt;hash&gt;</em><code>,</code><em>&lt;hash&gt;</em><code>..</code><em>&lt;hash&gt;</em>
1595<code>mode</code> <em>&lt;mode&gt;</em><code>,</code><em>&lt;mode&gt;</em>`<code>..</code><code>__</code><em>&lt;mode&gt;</em><code>__</code>
1596{empty}`new <code>file</code> <code>mode</code> <em>&lt;mode&gt;</em>
Junio C Hamano300c9262025-03-26 07:43:111597<code>deleted</code> <code>file</code> <code>mode</code> <em>&lt;mode&gt;</em><code>,</code><em>&lt;mode&gt;</em></pre>
1598</div>
1599<div class="paragraph">
1600<p>The <code>mode</code> <em>&lt;mode&gt;</em><code>,</code><em>&lt;mode&gt;</em><code>..</code><em>&lt;mode&gt;</em> line appears only if at least one of
1601the &lt;mode&gt; is different from the rest. Extended headers with
1602information about detected content movement (renames and
1603copying detection) are designed to work with the diff of two
1604<em>&lt;tree-ish&gt;</em> and are not used by combined diff format.</p>
1605</div>
1606</li>
1607<li>
1608<p>It is followed by a two-line from-file/to-file header:</p>
1609<div class="literalblock">
1610<div class="content">
1611<pre>--- a/file
1612+++ b/file</pre>
1613</div>
1614</div>
1615<div class="paragraph">
1616<p>Similar to the two-line header for the traditional <em>unified</em> diff
1617format, <code>/dev/null</code> is used to signal created or deleted
1618files.</p>
1619</div>
1620<div class="paragraph">
1621<p>However, if the --combined-all-paths option is provided, instead of a
1622two-line from-file/to-file, you get an N+1 line from-file/to-file header,
1623where N is the number of parents in the merge commit:</p>
1624</div>
1625<div class="literalblock">
1626<div class="content">
1627<pre>--- a/file
1628--- a/file
1629--- a/file
1630+++ b/file</pre>
1631</div>
1632</div>
1633<div class="paragraph">
1634<p>This extended format can be useful if rename or copy detection is
1635active, to allow you to see the original name of the file in different
1636parents.</p>
1637</div>
1638</li>
1639<li>
1640<p>Chunk header format is modified to prevent people from
1641accidentally feeding it to <code>patch</code> <code>-p1</code>. Combined diff format
1642was created for review of merge commit changes, and was not
1643meant to be applied. The change is similar to the change in the
1644extended <em>index</em> header:</p>
1645<div class="literalblock">
1646<div class="content">
1647<pre>@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</pre>
1648</div>
1649</div>
1650<div class="paragraph">
1651<p>There are (number of parents + 1) <code>@</code> characters in the chunk
1652header for combined diff format.</p>
1653</div>
1654</li>
1655</ol>
1656</div>
1657<div class="paragraph">
1658<p>Unlike the traditional <em>unified</em> diff format, which shows two
1659files A and B with a single column that has <code>-</code> (minus&#8201;&#8212;&#8201;appears in A but removed in B), <code>+</code> (plus&#8201;&#8212;&#8201;missing in A but
1660added to B), or " " (space&#8201;&#8212;&#8201;unchanged) prefix, this format
1661compares two or more files file1, file2,&#8230;&#8203; with one file X, and
1662shows how X differs from each of fileN. One column for each of
1663fileN is prepended to the output line to note how X&#8217;s line is
1664different from it.</p>
1665</div>
1666<div class="paragraph">
1667<p>A <code>-</code> character in the column N means that the line appears in
1668fileN but it does not appear in the result. A <code>+</code> character
1669in the column N means that the line appears in the result,
1670and fileN does not have that line (in other words, the line was
1671added, from the point of view of that parent).</p>
1672</div>
1673<div class="paragraph">
1674<p>In the above example output, the function signature was changed
1675from both files (hence two <code>-</code> removals from both file1 and
1676file2, plus <code>++</code> to mean one line that was added does not appear
1677in either file1 or file2). Also, eight other lines are the same
1678from file1 but do not appear in file2 (hence prefixed with <code>+</code>).</p>
1679</div>
1680<div class="paragraph">
1681<p>When shown by <code>git</code> <code>diff-tree</code> <code>-c</code>, it compares the parents of a
1682merge commit with the merge result (i.e. file1..fileN are the
1683parents). When shown by <code>git</code> <code>diff-files</code> <code>-c</code>, it compares the
1684two unresolved merge parents with the working tree file
1685(i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
1686"their version").</p>
1687</div>
1688</div>
1689</div>
1690<div class="sect1">
1691<h2 id="_git">GIT</h2>
1692<div class="sectionbody">
1693<div class="paragraph">
1694<p>Part of the <a href="git.html">git(1)</a> suite</p>
1695</div>
1696</div>
1697</div>
1698</div>
1699<div id="footer">
1700<div id="footer-text">
Junio C Hamanoe03f5992025-04-23 22:24:291701Last updated 2025-03-26 00:41:02 -0700
Junio C Hamano300c9262025-03-26 07:43:111702</div>
1703</div>
1704</body>
1705</html>