Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1 | <!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"/> |
Junio C Hamano | d6a33e4 | 2025-02-18 23:45:11 | [diff] [blame] | 7 | <meta name="generator" content="Asciidoctor 2.0.23"/> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 8 | <title>git-diff(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"; */ |
| 14 | html{font-family:sans-serif;-webkit-text-size-adjust:100%} |
| 15 | a{background:none} |
| 16 | a:focus{outline:thin dotted} |
| 17 | a:active,a:hover{outline:0} |
| 18 | h1{font-size:2em;margin:.67em 0} |
| 19 | b,strong{font-weight:bold} |
| 20 | abbr{font-size:.9em} |
| 21 | abbr[title]{cursor:help;border-bottom:1px dotted #dddddf;text-decoration:none} |
| 22 | dfn{font-style:italic} |
| 23 | hr{height:0} |
| 24 | mark{background:#ff0;color:#000} |
| 25 | code,kbd,pre,samp{font-family:monospace;font-size:1em} |
| 26 | pre{white-space:pre-wrap} |
| 27 | q{quotes:"\201C" "\201D" "\2018" "\2019"} |
| 28 | small{font-size:80%} |
| 29 | sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline} |
| 30 | sup{top:-.5em} |
| 31 | sub{bottom:-.25em} |
| 32 | img{border:0} |
| 33 | svg:not(:root){overflow:hidden} |
| 34 | figure{margin:0} |
| 35 | audio,video{display:inline-block} |
| 36 | audio:not([controls]){display:none;height:0} |
| 37 | fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em} |
| 38 | legend{border:0;padding:0} |
| 39 | button,input,select,textarea{font-family:inherit;font-size:100%;margin:0} |
| 40 | button,input{line-height:normal} |
| 41 | button,select{text-transform:none} |
| 42 | button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer} |
| 43 | button[disabled],html input[disabled]{cursor:default} |
| 44 | input[type=checkbox],input[type=radio]{padding:0} |
| 45 | button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0} |
| 46 | textarea{overflow:auto;vertical-align:top} |
| 47 | table{border-collapse:collapse;border-spacing:0} |
| 48 | *,::before,::after{box-sizing:border-box} |
| 49 | html,body{font-size:100%} |
| 50 | body{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} |
| 51 | a:hover{cursor:pointer} |
| 52 | img,object,embed{max-width:100%;height:auto} |
| 53 | object,embed{height:100%} |
| 54 | img{-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} |
| 62 | img,object,svg{display:inline-block;vertical-align:middle} |
| 63 | textarea{height:auto;min-height:50px} |
| 64 | select{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} |
| 66 | div,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} |
| 67 | a{color:#2156a5;text-decoration:underline;line-height:inherit} |
| 68 | a:hover,a:focus{color:#1d4b8f} |
| 69 | a img{border:0} |
| 70 | p{line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility} |
| 71 | p aside{font-size:.875em;line-height:1.35;font-style:italic} |
| 72 | h1,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} |
| 73 | h1 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} |
| 74 | h1{font-size:2.125em} |
| 75 | h2{font-size:1.6875em} |
| 76 | h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em} |
| 77 | h4,h5{font-size:1.125em} |
| 78 | h6{font-size:1em} |
| 79 | hr{border:solid #dddddf;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em} |
| 80 | em,i{font-style:italic;line-height:inherit} |
| 81 | strong,b{font-weight:bold;line-height:inherit} |
| 82 | small{font-size:60%;line-height:inherit} |
| 83 | code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)} |
| 84 | ul,ol,dl{line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit} |
| 85 | ul,ol{margin-left:1.5em} |
| 86 | ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0} |
| 87 | ul.circle{list-style-type:circle} |
| 88 | ul.disc{list-style-type:disc} |
| 89 | ul.square{list-style-type:square} |
| 90 | ul.circle ul:not([class]),ul.disc ul:not([class]),ul.square ul:not([class]){list-style:inherit} |
| 91 | ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0} |
| 92 | dl dt{margin-bottom:.3125em;font-weight:bold} |
| 93 | dl dd{margin-bottom:1.25em} |
| 94 | blockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd} |
| 95 | blockquote,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} |
| 97 | h1{font-size:2.75em} |
| 98 | h2{font-size:2.3125em} |
| 99 | h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em} |
| 100 | h4{font-size:1.4375em}} |
| 101 | table{background:#fff;margin-bottom:1.25em;border:1px solid #dedede;word-wrap:normal} |
| 102 | table thead,table tfoot{background:#f7f8f7} |
| 103 | table 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} |
| 104 | table tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)} |
| 105 | table tr.even,table tr.alt{background:#f8f8f7} |
| 106 | table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{line-height:1.6} |
| 107 | h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em} |
| 108 | h1 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} |
| 117 | pre{color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;line-height:1.45;text-rendering:optimizeSpeed} |
| 118 | pre code,pre pre{color:inherit;font-size:inherit;line-height:inherit} |
| 119 | pre>code{display:block} |
| 120 | pre.nowrap,pre.nowrap pre{white-space:pre;word-wrap:normal} |
| 121 | em em{font-style:normal} |
| 122 | strong strong{font-weight:400} |
| 123 | .keyseq{color:rgba(51,51,51,.8)} |
| 124 | kbd{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} |
| 132 | b.button::before,b.button::after{position:relative;top:-1px;font-weight:400} |
| 133 | b.button::before{content:"[";padding:0 3px 0 2px} |
| 134 | b.button::after{content:"]";padding:0 2px 0 3px} |
| 135 | p 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} |
Junio C Hamano | d6a33e4 | 2025-02-18 23:45:11 | [diff] [blame] | 143 | #header>h1:only-child{border-bottom:1px solid #dddddf;padding-bottom:8px} |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 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} |
| 164 | body.toc2{padding-left:15em;padding-right:0} |
Junio C Hamano | d6a33e4 | 2025-02-18 23:45:11 | [diff] [blame] | 165 | body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #dddddf;padding-bottom:8px} |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 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} |
| 171 | body.toc2.toc-right{padding-left:0;padding-right:15em} |
| 172 | body.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} |
| 178 | body.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} |
| 195 | details,.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em} |
| 196 | details{margin-left:1.25rem} |
| 197 | details>summary{cursor:pointer;display:block;position:relative;line-height:1.6;margin-bottom:.625rem;outline:none;-webkit-tap-highlight-color:transparent} |
| 198 | details>summary::-webkit-details-marker{display:none} |
| 199 | details>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%)} |
| 200 | details[open]>summary::before{border:solid transparent;border-top:solid;border-width:.5em .3em 0;transform:translateY(15%)} |
| 201 | details>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} |
| 203 | table.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} |
| 230 | pre.prettyprint .linenums{line-height:1.45;margin-left:2em} |
| 231 | pre.prettyprint li{background:none;list-style-type:inherit;padding-left:0} |
| 232 | pre.prettyprint li code[data-lang]::before{opacity:1} |
| 233 | pre.prettyprint li:not(:first-child) code[data-lang]::before{display:none} |
| 234 | table.linenotable{border-collapse:separate;border:0;margin-bottom:0;background:none} |
| 235 | table.linenotable td[class]{color:inherit;vertical-align:top;padding:0;line-height:inherit;white-space:normal} |
| 236 | table.linenotable td.code{padding-left:.75em} |
| 237 | table.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} |
| 238 | pre.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} |
| 261 | p.tableblock:last-child{margin-bottom:0} |
| 262 | td.tableblock>.content{margin-bottom:1.25em;word-wrap:anywhere} |
| 263 | td.tableblock>.content>:last-child{margin-bottom:-1.25em} |
| 264 | table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede} |
| 265 | table.grid-all>*>tr>*{border-width:1px} |
| 266 | table.grid-cols>*>tr>*{border-width:0 1px} |
| 267 | table.grid-rows>*>tr>*{border-width:1px 0} |
| 268 | table.frame-all{border-width:1px} |
| 269 | table.frame-ends{border-width:1px 0} |
| 270 | table.frame-sides{border-width:0 1px} |
| 271 | table.frame-none>colgroup+*>:first-child>*,table.frame-sides>colgroup+*>:first-child>*{border-top-width:0} |
| 272 | table.frame-none>:last-child>:last-child>*,table.frame-sides>:last-child>:last-child>*{border-bottom-width:0} |
| 273 | table.frame-none>*>tr>:first-child,table.frame-ends>*>tr>:first-child{border-left-width:0} |
| 274 | table.frame-none>*>tr>:last-child,table.frame-ends>*>tr>:last-child{border-right-width:0} |
| 275 | table.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} |
| 276 | th.halign-left,td.halign-left{text-align:left} |
| 277 | th.halign-right,td.halign-right{text-align:right} |
| 278 | th.halign-center,td.halign-center{text-align:center} |
| 279 | th.valign-top,td.valign-top{vertical-align:top} |
| 280 | th.valign-bottom,td.valign-bottom{vertical-align:bottom} |
| 281 | th.valign-middle,td.valign-middle{vertical-align:middle} |
| 282 | table thead th,table tfoot th{font-weight:bold} |
| 283 | tbody tr th{background:#f7f8f7} |
| 284 | tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold} |
| 285 | p.tableblock>code:only-child{background:none;padding:0} |
| 286 | p.tableblock{font-size:1em} |
| 287 | ol{margin-left:1.75em} |
| 288 | ul li ol{margin-left:1.5em} |
| 289 | dl dd{margin-left:1.125em} |
| 290 | dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0} |
| 291 | li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em} |
| 292 | ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none} |
| 293 | ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:.625em} |
| 294 | ul.unstyled,ol.unstyled{margin-left:0} |
| 295 | li>p:empty:only-child::before{content:"";display:inline-block} |
| 296 | ul.checklist>li>p:first-child{margin-left:-1em} |
| 297 | ul.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} |
| 298 | ul.checklist>li>p:first-child>input[type=checkbox]:first-child{margin-right:.25em} |
| 299 | ul.inline{display:flex;flex-flow:row wrap;list-style:none;margin:0 0 .625em -1.25em} |
| 300 | ul.inline>li{margin-left:1.25em} |
| 301 | .unstyled dl dt{font-weight:400;font-style:normal} |
| 302 | ol.arabic{list-style-type:decimal} |
| 303 | ol.decimal{list-style-type:decimal-leading-zero} |
| 304 | ol.loweralpha{list-style-type:lower-alpha} |
| 305 | ol.upperalpha{list-style-type:upper-alpha} |
| 306 | ol.lowerroman{list-style-type:lower-roman} |
| 307 | ol.upperroman{list-style-type:upper-roman} |
| 308 | ol.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} |
| 311 | td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em} |
| 312 | td.hdlist1{font-weight:bold;padding-bottom:1.25em} |
| 313 | td.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} |
| 327 | a.image{text-decoration:none;display:inline-block} |
| 328 | a.image object{pointer-events:none} |
| 329 | sup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super} |
| 330 | sup.footnote a,sup.footnoteref a{text-decoration:none} |
Junio C Hamano | d6a33e4 | 2025-02-18 23:45:11 | [diff] [blame] | 331 | sup.footnote a:active,sup.footnoteref a:active,#footnotes .footnote a:first-of-type:active{text-decoration:underline} |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 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} |
| 338 | div.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} |
| 376 | span.icon>.fa{cursor:default} |
| 377 | a 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)} |
| 388 | pre .conum[data-value]{position:relative;top:-.125em} |
| 389 | b.conum *{color:inherit!important} |
| 390 | .conum:not([data-value]):empty{display:none} |
| 391 | dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility} |
| 392 | h1,h2,p,td.content,span.alt,summary{letter-spacing:-.01em} |
| 393 | p strong,td.content strong,div.footnote strong{letter-spacing:-.005em} |
| 394 | p,blockquote,dt,td.content,td.hdlist1,span.alt,summary{font-size:1.0625rem} |
| 395 | p{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} |
| 401 | html{font-size:80%} |
| 402 | a{color:inherit!important;text-decoration:underline!important} |
| 403 | a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important} |
| 404 | a[href^="http:"]:not(.bare)::after,a[href^="https:"]:not(.bare)::after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em} |
| 405 | abbr[title]{border-bottom:1px dotted} |
| 406 | abbr[title]::after{content:" (" attr(title) ")"} |
| 407 | pre,blockquote,tr,img,object,svg{page-break-inside:avoid} |
| 408 | thead{display:table-header-group} |
| 409 | svg{max-width:100%} |
| 410 | p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3} |
| 411 | h2,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} |
| 415 | body.book #header{text-align:center} |
| 416 | body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em} |
| 417 | body.book #header .details{border:0!important;display:block;padding:0!important} |
| 418 | body.book #header .details span:first-child{margin-left:0!important} |
| 419 | body.book #header .details br{display:block} |
| 420 | body.book #header .details br+span::before{content:none!important} |
| 421 | body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important} |
| 422 | body.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> |
| 437 | pre>code { |
| 438 | display: inline; |
| 439 | } |
| 440 | </style> |
| 441 | </head> |
| 442 | <body class="manpage"> |
| 443 | <div id="header"> |
| 444 | <h1>git-diff(1) Manual Page</h1> |
| 445 | <h2 id="_name">NAME</h2> |
| 446 | <div class="sectionbody"> |
| 447 | <p>git-diff - Show changes between commits, commit and working tree, etc</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"> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 455 | <pre class="content"><code>git</code> <code>diff</code> [<em><options></em>] [<em><commit></em>] [<code>--</code>] [<em><path></em>…​] |
| 456 | <code>git</code> <code>diff</code> [<em><options></em>] <code>--cached</code> [<code>--merge-base</code>] [<em><commit></em>] [<code>--</code>] [<em><path></em>…​] |
| 457 | <code>git</code> <code>diff</code> [<em><options></em>] [<code>--merge-base</code>] <em><commit></em> [<em><commit></em>…​] <em><commit></em> [<code>--</code>] [<em><path></em>…​] |
Junio C Hamano | e03f599 | 2025-04-23 22:24:29 | [diff] [blame] | 458 | <code>git</code> <code>diff</code> [<em><options></em>] <em><commit></em><code>...</code><em><commit></em> [<code>--</code>] [<em><path></em>…​] |
| 459 | <code>git</code> <code>diff</code> [<em><options></em>] <em><blob></em> <em><blob></em> |
Junio C Hamano | a644284 | 2025-06-18 21:56:06 | [diff] [blame] | 460 | <code>git</code> <code>diff</code> [<em><options></em>] <code>--no-index</code> [<code>--</code>] <em><path></em> <em><path></em> [<em><pathspec></em>…​]</pre> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 461 | </div> |
| 462 | </div> |
| 463 | </div> |
| 464 | <div class="sect1"> |
| 465 | <h2 id="_description">DESCRIPTION</h2> |
| 466 | <div class="sectionbody"> |
| 467 | <div class="paragraph"> |
| 468 | <p>Show changes between the working tree and the index or a tree, changes |
| 469 | between the index and a tree, changes between two trees, changes resulting |
| 470 | from a merge, changes between two blob objects, or changes between two |
| 471 | files on disk.</p> |
| 472 | </div> |
| 473 | <div class="dlist"> |
| 474 | <dl> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 475 | <dt class="hdlist1"><code>git</code> <code>diff</code> [<em><options></em>] [<code>--</code>] [<em><path></em>...]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 476 | <dd> |
| 477 | <p>This form is to view the changes you made relative to |
| 478 | the index (staging area for the next commit). In other |
| 479 | words, the differences are what you <em>could</em> tell Git to |
| 480 | further add to the index but you still haven’t. You can |
| 481 | stage these changes by using <a href="git-add.html">git-add(1)</a>.</p> |
| 482 | </dd> |
Junio C Hamano | a644284 | 2025-06-18 21:56:06 | [diff] [blame] | 483 | <dt class="hdlist1"><code>git</code> <code>diff</code> [<em><options></em>] <code>--no-index</code> [<code>--</code>] <em><path></em> <em><path></em> [<em><pathspec></em>...]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 484 | <dd> |
| 485 | <p>This form is to compare the given two paths on the |
| 486 | filesystem. You can omit the <code>--no-index</code> option when |
| 487 | running the command in a working tree controlled by Git and |
| 488 | at least one of the paths points outside the working tree, |
| 489 | or when running the command outside a working tree |
Junio C Hamano | a644284 | 2025-06-18 21:56:06 | [diff] [blame] | 490 | controlled by Git. This form implies <code>--exit-code</code>. If both |
| 491 | paths point to directories, additional pathspecs may be |
| 492 | provided. These will limit the files included in the |
| 493 | difference. All such pathspecs must be relative as they |
| 494 | apply to both sides of the diff.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 495 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 496 | <dt class="hdlist1"><code>git</code> <code>diff</code> [<em><options></em>] <code>--cached</code> [<code>--merge-base</code>] [<em><commit></em>] [<code>--</code>] [<em><path></em>...]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 497 | <dd> |
| 498 | <p>This form is to view the changes you staged for the next |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 499 | commit relative to the named <em><commit></em>. Typically you |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 500 | would want comparison with the latest commit, so if you |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 501 | do not give <em><commit></em>, it defaults to <code>HEAD</code>. |
| 502 | If <code>HEAD</code> does not exist (e.g. unborn branches) and |
| 503 | <em><commit></em> is not given, it shows all staged changes. |
| 504 | <code>--staged</code> is a synonym of <code>--cached</code>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 505 | <div class="paragraph"> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 506 | <p>If <code>--merge-base</code> is given, instead of using <em><commit></em>, use the merge base |
| 507 | of <em><commit></em> and <code>HEAD</code>. <code>git</code> <code>diff</code> <code>--cached</code> <code>--merge-base</code> <code>A</code> is equivalent to |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 508 | <code>git</code> <code>diff</code> <code>--cached</code> <code>$</code>(<code>git</code> <code>merge-base</code> <code>A</code> <code>HEAD</code>).</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 509 | </div> |
| 510 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 511 | <dt class="hdlist1"><code>git</code> <code>diff</code> [<em><options></em>] [<code>--merge-base</code>] <em><commit></em> [<code>--</code>] [<em><path></em>...]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 512 | <dd> |
| 513 | <p>This form is to view the changes you have in your |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 514 | working tree relative to the named <em><commit></em>. You can |
| 515 | use <code>HEAD</code> to compare it with the latest commit, or a |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 516 | branch name to compare with the tip of a different |
| 517 | branch.</p> |
| 518 | <div class="paragraph"> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 519 | <p>If <code>--merge-base</code> is given, instead of using <em><commit></em>, use the merge base |
| 520 | of <em><commit></em> and <code>HEAD</code>. <code>git</code> <code>diff</code> <code>--merge-base</code> <code>A</code> is equivalent to |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 521 | <code>git</code> <code>diff</code> <code>$</code>(<code>git</code> <code>merge-base</code> <code>A</code> <code>HEAD</code>).</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 522 | </div> |
| 523 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 524 | <dt class="hdlist1"><code>git</code> <code>diff</code> [<em><options></em>] [<code>--merge-base</code>] <em><commit></em> <em><commit></em> [<code>--</code>] [<em><path></em>...]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 525 | <dd> |
| 526 | <p>This is to view the changes between two arbitrary |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 527 | <em><commit></em>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 528 | <div class="paragraph"> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 529 | <p>If <code>--merge-base</code> is given, use the merge base of the two commits for the |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 530 | "before" side. <code>git</code> <code>diff</code> <code>--merge-base</code> <code>A</code> <code>B</code> is equivalent to |
| 531 | <code>git</code> <code>diff</code> <code>$</code>(<code>git</code> <code>merge-base</code> <code>A</code> <code>B</code>) <code>B</code>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 532 | </div> |
| 533 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 534 | <dt class="hdlist1"><code>git</code> <code>diff</code> [<em><options></em>] <em><commit></em> <em><commit></em><code>...</code><em><commit></em> [<code>--</code>] [<em><path></em>...]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 535 | <dd> |
| 536 | <p>This form is to view the results of a merge commit. The first |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 537 | listed <em><commit></em> must be the merge itself; the remaining two or |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 538 | more commits should be its parents. Convenient ways to produce |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 539 | the desired set of revisions are to use the suffixes <code>@</code> and |
| 540 | <code>^</code>!. If <code>A</code> is a merge commit, then <code>git</code> <code>diff</code> <code>A</code> <code>A^@</code>, |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 541 | <code>git</code> <code>diff</code> <code>A^</code>! and <code>git</code> <code>show</code> <code>A</code> all give the same combined diff.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 542 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 543 | <dt class="hdlist1"><code>git</code> <code>diff</code> [<em><options></em>] <em><commit></em><code>..</code><em><commit></em> [<code>--</code>] [<em><path></em>...]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 544 | <dd> |
Junio C Hamano | e03f599 | 2025-04-23 22:24:29 | [diff] [blame] | 545 | <p>This is synonymous to the earlier form (without the <code>..</code>) for |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 546 | viewing the changes between two arbitrary <em><commit></em>. If <em><commit></em> on |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 547 | one side is omitted, it will have the same effect as |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 548 | using <code>HEAD</code> instead.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 549 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 550 | <dt class="hdlist1"><code>git</code> <code>diff</code> [<em><options></em>] <em><commit></em><code>...</code><em><commit></em> [<code>--</code>] [<em><path></em>...]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 551 | <dd> |
| 552 | <p>This form is to view the changes on the branch containing |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 553 | and up to the second <em><commit></em>, starting at a common ancestor |
| 554 | of both <em><commit></em>. <code>git</code> <code>diff</code> <code>A</code><code>...</code><code>B</code> is equivalent to |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 555 | <code>git</code> <code>diff</code> <code>$</code>(<code>git</code> <code>merge-base</code> <code>A</code> <code>B</code>) <code>B</code>. You can omit any one |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 556 | of <em><commit></em>, which has the same effect as using <code>HEAD</code> instead.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 557 | </dd> |
| 558 | </dl> |
| 559 | </div> |
| 560 | <div class="paragraph"> |
| 561 | <p>Just in case you are doing something exotic, it should be |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 562 | noted that all of the <em><commit></em> in the above description, except |
Junio C Hamano | e03f599 | 2025-04-23 22:24:29 | [diff] [blame] | 563 | in the <code>--merge-base</code> case and in the last two forms that use <code>..</code> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 564 | notations, can be any <em><tree></em>. A tree of interest is the one pointed to |
| 565 | by the ref named <code>AUTO_MERGE</code>, which is written by the <code>ort</code> merge |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 566 | strategy upon hitting merge conflicts (see <a href="git-merge.html">git-merge(1)</a>). |
| 567 | Comparing the working tree with <code>AUTO_MERGE</code> shows changes you’ve made |
| 568 | so far to resolve textual conflicts (see the examples below).</p> |
| 569 | </div> |
| 570 | <div class="paragraph"> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 571 | <p>For a more complete list of ways to spell <em><commit></em>, see |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 572 | "SPECIFYING REVISIONS" section in <a href="gitrevisions.html">gitrevisions(7)</a>. |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 573 | However, <code>diff</code> is about comparing two <em>endpoints</em>, not ranges, |
| 574 | and the range notations (<em><commit></em><code>..</code><em><commit></em> and <em><commit></em><code>...</code><em><commit></em>) |
| 575 | do not mean a range as defined in the |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 576 | "SPECIFYING RANGES" section in <a href="gitrevisions.html">gitrevisions(7)</a>.</p> |
| 577 | </div> |
| 578 | <div class="dlist"> |
| 579 | <dl> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 580 | <dt class="hdlist1"><code>git</code> <code>diff</code> [<em><options></em>] <em><blob></em> <em><blob></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 581 | <dd> |
| 582 | <p>This form is to view the differences between the raw |
| 583 | contents of two blob objects.</p> |
| 584 | </dd> |
| 585 | </dl> |
| 586 | </div> |
| 587 | </div> |
| 588 | </div> |
| 589 | <div class="sect1"> |
| 590 | <h2 id="_options">OPTIONS</h2> |
| 591 | <div class="sectionbody"> |
| 592 | <div class="dlist"> |
| 593 | <dl> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 594 | <dt class="hdlist1"><code>-p</code></dt> |
| 595 | <dt class="hdlist1"><code>-u</code></dt> |
| 596 | <dt class="hdlist1"><code>--patch</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 597 | <dd> |
| 598 | <p>Generate patch (see <a href="#generate_patch_text_with_p">Generating patch text with -p</a>). |
| 599 | This is the default.</p> |
| 600 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 601 | <dt class="hdlist1"><code>-s</code></dt> |
| 602 | <dt class="hdlist1"><code>--no-patch</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 603 | <dd> |
| 604 | <p>Suppress all output from the diff machinery. Useful for |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 605 | commands like <code>git</code> <code>show</code> that show the patch by default to |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 606 | squelch their output, or to cancel the effect of options like |
| 607 | <code>--patch</code>, <code>--stat</code> earlier on the command line in an alias.</p> |
| 608 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 609 | <dt class="hdlist1"><code>-U</code><em><n></em></dt> |
| 610 | <dt class="hdlist1"><code>--unified=</code><em><n></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 611 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 612 | <p>Generate diffs with <em><n></em> lines of context instead of |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 613 | the usual three. |
| 614 | Implies <code>--patch</code>.</p> |
| 615 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 616 | <dt class="hdlist1"><code>--output=</code><em><file></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 617 | <dd> |
| 618 | <p>Output to a specific file instead of stdout.</p> |
| 619 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 620 | <dt class="hdlist1"><code>--output-indicator-new=</code><em><char></em></dt> |
| 621 | <dt class="hdlist1"><code>--output-indicator-old=</code><em><char></em></dt> |
| 622 | <dt class="hdlist1"><code>--output-indicator-context=</code><em><char></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 623 | <dd> |
| 624 | <p>Specify the character used to indicate new, old or context |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 625 | lines in the generated patch. Normally they are <code>+</code>, <code>-</code> and |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 626 | ' ' respectively.</p> |
| 627 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 628 | <dt class="hdlist1"><code>--raw</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 629 | <dd> |
| 630 | <p>Generate the diff in raw format.</p> |
| 631 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 632 | <dt class="hdlist1"><code>--patch-with-raw</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 633 | <dd> |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 634 | <p>Synonym for <code>-p</code> <code>--raw</code>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 635 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 636 | <dt class="hdlist1"><code>--indent-heuristic</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 637 | <dd> |
| 638 | <p>Enable the heuristic that shifts diff hunk boundaries to make patches |
| 639 | easier to read. This is the default.</p> |
| 640 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 641 | <dt class="hdlist1"><code>--no-indent-heuristic</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 642 | <dd> |
| 643 | <p>Disable the indent heuristic.</p> |
| 644 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 645 | <dt class="hdlist1"><code>--minimal</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 646 | <dd> |
| 647 | <p>Spend extra time to make sure the smallest possible |
| 648 | diff is produced.</p> |
| 649 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 650 | <dt class="hdlist1"><code>--patience</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 651 | <dd> |
| 652 | <p>Generate a diff using the "patience diff" algorithm.</p> |
| 653 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 654 | <dt class="hdlist1"><code>--histogram</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 655 | <dd> |
| 656 | <p>Generate a diff using the "histogram diff" algorithm.</p> |
| 657 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 658 | <dt class="hdlist1"><code>--anchored=</code><em><text></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 659 | <dd> |
| 660 | <p>Generate a diff using the "anchored diff" algorithm.</p> |
| 661 | <div class="paragraph"> |
| 662 | <p>This option may be specified more than once.</p> |
| 663 | </div> |
| 664 | <div class="paragraph"> |
| 665 | <p>If a line exists in both the source and destination, exists only once, |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 666 | and starts with <em><text></em>, this algorithm attempts to prevent it from |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 667 | appearing as a deletion or addition in the output. It uses the "patience |
| 668 | diff" algorithm internally.</p> |
| 669 | </div> |
| 670 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 671 | <dt class="hdlist1"><code>--diff-algorithm=</code>(<code>patience</code>|<code>minimal</code>|<code>histogram</code>|<code>myers</code>)</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 672 | <dd> |
| 673 | <p>Choose a diff algorithm. The variants are as follows:</p> |
| 674 | <div class="openblock"> |
| 675 | <div class="content"> |
| 676 | <div class="dlist"> |
| 677 | <dl> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 678 | <dt class="hdlist1"><code>default</code></dt> |
| 679 | <dt class="hdlist1"><code>myers</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 680 | <dd> |
| 681 | <p>The basic greedy diff algorithm. Currently, this is the default.</p> |
| 682 | </dd> |
| 683 | <dt class="hdlist1"><code>minimal</code></dt> |
| 684 | <dd> |
| 685 | <p>Spend extra time to make sure the smallest possible diff is |
| 686 | produced.</p> |
| 687 | </dd> |
| 688 | <dt class="hdlist1"><code>patience</code></dt> |
| 689 | <dd> |
| 690 | <p>Use "patience diff" algorithm when generating patches.</p> |
| 691 | </dd> |
| 692 | <dt class="hdlist1"><code>histogram</code></dt> |
| 693 | <dd> |
| 694 | <p>This algorithm extends the patience algorithm to "support |
| 695 | low-occurrence common elements".</p> |
| 696 | </dd> |
| 697 | </dl> |
| 698 | </div> |
| 699 | </div> |
| 700 | </div> |
| 701 | <div class="paragraph"> |
| 702 | <p>For instance, if you configured the <code>diff.algorithm</code> variable to a |
| 703 | non-default value and want to use the default one, then you |
| 704 | have to use <code>--diff-algorithm=default</code> option.</p> |
| 705 | </div> |
| 706 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 707 | <dt class="hdlist1"><code>--stat</code>[<code>=</code><em><width></em>[<code>,</code><em><name-width></em>[<code>,</code><em><count></em>]]]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 708 | <dd> |
| 709 | <p>Generate a diffstat. By default, as much space as necessary |
| 710 | will be used for the filename part, and the rest for the graph |
| 711 | part. Maximum width defaults to terminal width, or 80 columns |
| 712 | if not connected to a terminal, and can be overridden by |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 713 | <em><width></em>. The width of the filename part can be limited by |
| 714 | giving another width <em><name-width></em> after a comma or by setting |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 715 | <code>diff.statNameWidth=</code><em><name-width></em>. The width of the graph part can be |
| 716 | limited by using <code>--stat-graph-width=</code><em><graph-width></em> or by setting |
| 717 | <code>diff.statGraphWidth=</code><em><graph-width></em>. Using <code>--stat</code> or |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 718 | <code>--stat-graph-width</code> affects all commands generating a stat graph, |
| 719 | while setting <code>diff.statNameWidth</code> or <code>diff.statGraphWidth</code> |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 720 | does not affect <code>git</code> <code>format-patch</code>. |
| 721 | By giving a third parameter <em><count></em>, you can limit the output to |
Junio C Hamano | e03f599 | 2025-04-23 22:24:29 | [diff] [blame] | 722 | the first <em><count></em> lines, followed by <code>...</code> if there are more.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 723 | <div class="paragraph"> |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 724 | <p>These parameters can also be set individually with <code>--stat-width=</code><em><width></em>, |
| 725 | <code>--stat-name-width=</code><em><name-width></em> and <code>--stat-count=</code><em><count></em>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 726 | </div> |
| 727 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 728 | <dt class="hdlist1"><code>--compact-summary</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 729 | <dd> |
| 730 | <p>Output a condensed summary of extended header information such |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 731 | as file creations or deletions ("new" or "gone", optionally <code>+l</code> |
| 732 | if it’s a symlink) and mode changes (<code>+x</code> or <code>-x</code> for adding |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 733 | or removing executable bit respectively) in diffstat. The |
| 734 | information is put between the filename part and the graph |
| 735 | part. Implies <code>--stat</code>.</p> |
| 736 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 737 | <dt class="hdlist1"><code>--numstat</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 738 | <dd> |
| 739 | <p>Similar to <code>--stat</code>, but shows number of added and |
| 740 | deleted lines in decimal notation and pathname without |
| 741 | abbreviation, to make it more machine friendly. For |
| 742 | binary files, outputs two <code>-</code> instead of saying |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 743 | <code>0</code> <code>0</code>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 744 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 745 | <dt class="hdlist1"><code>--shortstat</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 746 | <dd> |
| 747 | <p>Output only the last line of the <code>--stat</code> format containing total |
| 748 | number of modified files, as well as number of added and deleted |
| 749 | lines.</p> |
| 750 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 751 | <dt class="hdlist1"><code>-X</code> [<em><param></em><code>,..</code>.]</dt> |
| 752 | <dt class="hdlist1"><code>--dirstat</code>[<code>=</code><em><param></em><code>,..</code>.]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 753 | <dd> |
| 754 | <p>Output the distribution of relative amount of changes for each |
| 755 | sub-directory. The behavior of <code>--dirstat</code> can be customized by |
| 756 | passing it a comma separated list of parameters. |
| 757 | The defaults are controlled by the <code>diff.dirstat</code> configuration |
| 758 | variable (see <a href="git-config.html">git-config(1)</a>). |
| 759 | The following parameters are available:</p> |
| 760 | <div class="openblock"> |
| 761 | <div class="content"> |
| 762 | <div class="dlist"> |
| 763 | <dl> |
| 764 | <dt class="hdlist1"><code>changes</code></dt> |
| 765 | <dd> |
| 766 | <p>Compute the dirstat numbers by counting the lines that have been |
| 767 | removed from the source, or added to the destination. This ignores |
| 768 | the amount of pure code movements within a file. In other words, |
| 769 | rearranging lines in a file is not counted as much as other changes. |
| 770 | This is the default behavior when no parameter is given.</p> |
| 771 | </dd> |
| 772 | <dt class="hdlist1"><code>lines</code></dt> |
| 773 | <dd> |
| 774 | <p>Compute the dirstat numbers by doing the regular line-based diff |
| 775 | analysis, and summing the removed/added line counts. (For binary |
| 776 | files, count 64-byte chunks instead, since binary files have no |
| 777 | natural concept of lines). This is a more expensive <code>--dirstat</code> |
| 778 | behavior than the <code>changes</code> behavior, but it does count rearranged |
| 779 | lines within a file as much as other changes. The resulting output |
Junio C Hamano | e03f599 | 2025-04-23 22:24:29 | [diff] [blame] | 780 | is consistent with what you get from the other <code>--*stat</code> options.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 781 | </dd> |
| 782 | <dt class="hdlist1"><code>files</code></dt> |
| 783 | <dd> |
| 784 | <p>Compute the dirstat numbers by counting the number of files changed. |
| 785 | Each changed file counts equally in the dirstat analysis. This is |
| 786 | the computationally cheapest <code>--dirstat</code> behavior, since it does |
| 787 | not have to look at the file contents at all.</p> |
| 788 | </dd> |
| 789 | <dt class="hdlist1"><code>cumulative</code></dt> |
| 790 | <dd> |
| 791 | <p>Count changes in a child directory for the parent directory as well. |
| 792 | Note that when using <code>cumulative</code>, the sum of the percentages |
| 793 | reported may exceed 100%. The default (non-cumulative) behavior can |
| 794 | be specified with the <code>noncumulative</code> parameter.</p> |
| 795 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 796 | <dt class="hdlist1"><em><limit></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 797 | <dd> |
| 798 | <p>An integer parameter specifies a cut-off percent (3% by default). |
| 799 | Directories contributing less than this percentage of the changes |
| 800 | are not shown in the output.</p> |
| 801 | </dd> |
| 802 | </dl> |
| 803 | </div> |
| 804 | </div> |
| 805 | </div> |
| 806 | <div class="paragraph"> |
| 807 | <p>Example: The following will count changed files, while ignoring |
| 808 | directories with less than 10% of the total amount of changed files, |
| 809 | and accumulating child directory counts in the parent directories: |
| 810 | <code>--dirstat=files,10,cumulative</code>.</p> |
| 811 | </div> |
| 812 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 813 | <dt class="hdlist1"><code>--cumulative</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 814 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 815 | <p>Synonym for <code>--dirstat=cumulative</code>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 816 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 817 | <dt class="hdlist1"><code>--dirstat-by-file</code>[<code>=</code><em><param></em><code>,..</code>.]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 818 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 819 | <p>Synonym for <code>--dirstat=files,</code><em><param></em><code>,..</code>..</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 820 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 821 | <dt class="hdlist1"><code>--summary</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 822 | <dd> |
| 823 | <p>Output a condensed summary of extended header information |
| 824 | such as creations, renames and mode changes.</p> |
| 825 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 826 | <dt class="hdlist1"><code>--patch-with-stat</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 827 | <dd> |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 828 | <p>Synonym for <code>-p</code> <code>--stat</code>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 829 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 830 | <dt class="hdlist1"><code>-z</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 831 | <dd> |
| 832 | <p>When <code>--raw</code>, <code>--numstat</code>, <code>--name-only</code> or <code>--name-status</code> has been |
| 833 | given, do not munge pathnames and use NULs as output field terminators.</p> |
| 834 | <div class="paragraph"> |
| 835 | <p>Without this option, pathnames with "unusual" characters are quoted as |
| 836 | explained for the configuration variable <code>core.quotePath</code> (see |
| 837 | <a href="git-config.html">git-config(1)</a>).</p> |
| 838 | </div> |
| 839 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 840 | <dt class="hdlist1"><code>--name-only</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 841 | <dd> |
| 842 | <p>Show only the name of each changed file in the post-image tree. |
| 843 | The file names are often encoded in UTF-8. |
| 844 | For more information see the discussion about encoding in the <a href="git-log.html">git-log(1)</a> |
| 845 | manual page.</p> |
| 846 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 847 | <dt class="hdlist1"><code>--name-status</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 848 | <dd> |
| 849 | <p>Show only the name(s) and status of each changed file. See the description |
| 850 | of the <code>--diff-filter</code> option on what the status letters mean. |
| 851 | Just like <code>--name-only</code> the file names are often encoded in UTF-8.</p> |
| 852 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 853 | <dt class="hdlist1"><code>--submodule</code>[<code>=</code><em><format></em>]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 854 | <dd> |
| 855 | <p>Specify how differences in submodules are shown. When specifying |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 856 | <code>--submodule=short</code> the <code>short</code> format is used. This format just |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 857 | shows the names of the commits at the beginning and end of the range. |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 858 | When <code>--submodule</code> or <code>--submodule=log</code> is specified, the <code>log</code> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 859 | format is used. This format lists the commits in the range like |
| 860 | <a href="git-submodule.html">git-submodule(1)</a> <code>summary</code> does. When <code>--submodule=diff</code> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 861 | is specified, the <code>diff</code> format is used. This format shows an |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 862 | inline diff of the changes in the submodule contents between the |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 863 | commit range. Defaults to <code>diff.submodule</code> or the <code>short</code> format |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 864 | if the config option is unset.</p> |
| 865 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 866 | <dt class="hdlist1"><code>--color</code>[<code>=</code><em><when></em>]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 867 | <dd> |
| 868 | <p>Show colored diff. |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 869 | <code>--color</code> (i.e. without <code>=</code><em><when></em>) is the same as <code>--color=always</code>. |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 870 | <em><when></em> can be one of <code>always</code>, <code>never</code>, or <code>auto</code>. |
| 871 | It can be changed by the <code>color.ui</code> and <code>color.diff</code> |
| 872 | configuration settings.</p> |
| 873 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 874 | <dt class="hdlist1"><code>--no-color</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 875 | <dd> |
| 876 | <p>Turn off colored diff. |
| 877 | This can be used to override configuration settings. |
| 878 | It is the same as <code>--color=never</code>.</p> |
| 879 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 880 | <dt class="hdlist1"><code>--color-moved</code>[<code>=</code><em><mode></em>]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 881 | <dd> |
| 882 | <p>Moved lines of code are colored differently. |
| 883 | It can be changed by the <code>diff.colorMoved</code> configuration setting. |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 884 | The <em><mode></em> defaults to <code>no</code> if the option is not given |
| 885 | and to <code>zebra</code> if the option with no mode is given. |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 886 | The mode must be one of:</p> |
| 887 | <div class="openblock"> |
| 888 | <div class="content"> |
| 889 | <div class="dlist"> |
| 890 | <dl> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 891 | <dt class="hdlist1"><code>no</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 892 | <dd> |
| 893 | <p>Moved lines are not highlighted.</p> |
| 894 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 895 | <dt class="hdlist1"><code>default</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 896 | <dd> |
| 897 | <p>Is a synonym for <code>zebra</code>. This may change to a more sensible mode |
| 898 | in the future.</p> |
| 899 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 900 | <dt class="hdlist1"><code>plain</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 901 | <dd> |
| 902 | <p>Any line that is added in one location and was removed |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 903 | in another location will be colored with <code>color.diff.newMoved</code>. |
| 904 | Similarly <code>color.diff.oldMoved</code> will be used for removed lines |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 905 | that are added somewhere else in the diff. This mode picks up any |
| 906 | moved line, but it is not very useful in a review to determine |
| 907 | if a block of code was moved without permutation.</p> |
| 908 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 909 | <dt class="hdlist1"><code>blocks</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 910 | <dd> |
| 911 | <p>Blocks of moved text of at least 20 alphanumeric characters |
| 912 | are detected greedily. The detected blocks are |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 913 | painted using either the <code>color.diff.</code>(<code>old</code>|<code>new</code>)<code>Moved</code> color. |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 914 | Adjacent blocks cannot be told apart.</p> |
| 915 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 916 | <dt class="hdlist1"><code>zebra</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 917 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 918 | <p>Blocks of moved text are detected as in <code>blocks</code> mode. The blocks |
| 919 | are painted using either the <code>color.diff.</code>(<code>old</code>|<code>new</code>)<code>Moved</code> color or |
| 920 | <code>color.diff.</code>(<code>old</code>|<code>new</code>)<code>MovedAlternative</code>. The change between |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 921 | the two colors indicates that a new block was detected.</p> |
| 922 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 923 | <dt class="hdlist1"><code>dimmed-zebra</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 924 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 925 | <p>Similar to <code>zebra</code>, but additional dimming of uninteresting parts |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 926 | of moved code is performed. The bordering lines of two adjacent |
| 927 | blocks are considered interesting, the rest is uninteresting. |
| 928 | <code>dimmed_zebra</code> is a deprecated synonym.</p> |
| 929 | </dd> |
| 930 | </dl> |
| 931 | </div> |
| 932 | </div> |
| 933 | </div> |
| 934 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 935 | <dt class="hdlist1"><code>--no-color-moved</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 936 | <dd> |
| 937 | <p>Turn off move detection. This can be used to override configuration |
| 938 | settings. It is the same as <code>--color-moved=no</code>.</p> |
| 939 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 940 | <dt class="hdlist1"><code>--color-moved-ws=</code><em><mode></em><code>,..</code>.</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 941 | <dd> |
| 942 | <p>This configures how whitespace is ignored when performing the |
| 943 | move detection for <code>--color-moved</code>. |
| 944 | It can be set by the <code>diff.colorMovedWS</code> configuration setting. |
| 945 | These modes can be given as a comma separated list:</p> |
| 946 | <div class="openblock"> |
| 947 | <div class="content"> |
| 948 | <div class="dlist"> |
| 949 | <dl> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 950 | <dt class="hdlist1"><code>no</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 951 | <dd> |
| 952 | <p>Do not ignore whitespace when performing move detection.</p> |
| 953 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 954 | <dt class="hdlist1"><code>ignore-space-at-eol</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 955 | <dd> |
| 956 | <p>Ignore changes in whitespace at EOL.</p> |
| 957 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 958 | <dt class="hdlist1"><code>ignore-space-change</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 959 | <dd> |
| 960 | <p>Ignore changes in amount of whitespace. This ignores whitespace |
| 961 | at line end, and considers all other sequences of one or |
| 962 | more whitespace characters to be equivalent.</p> |
| 963 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 964 | <dt class="hdlist1"><code>ignore-all-space</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 965 | <dd> |
| 966 | <p>Ignore whitespace when comparing lines. This ignores differences |
| 967 | even if one line has whitespace where the other line has none.</p> |
| 968 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 969 | <dt class="hdlist1"><code>allow-indentation-change</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 970 | <dd> |
| 971 | <p>Initially ignore any whitespace in the move detection, then |
| 972 | group the moved code blocks only into a block if the change in |
| 973 | whitespace is the same per line. This is incompatible with the |
| 974 | other modes.</p> |
| 975 | </dd> |
| 976 | </dl> |
| 977 | </div> |
| 978 | </div> |
| 979 | </div> |
| 980 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 981 | <dt class="hdlist1"><code>--no-color-moved-ws</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 982 | <dd> |
| 983 | <p>Do not ignore whitespace when performing move detection. This can be |
| 984 | used to override configuration settings. It is the same as |
| 985 | <code>--color-moved-ws=no</code>.</p> |
| 986 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 987 | <dt class="hdlist1"><code>--word-diff</code>[<code>=</code><em><mode></em>]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 988 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 989 | <p>By default, words are delimited by whitespace; see |
| 990 | <code>--word-diff-regex</code> below. The <em><mode></em> defaults to <code>plain</code>, and |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 991 | must be one of:</p> |
| 992 | <div class="openblock"> |
| 993 | <div class="content"> |
| 994 | <div class="dlist"> |
| 995 | <dl> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 996 | <dt class="hdlist1"><code>color</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 997 | <dd> |
| 998 | <p>Highlight changed words using only colors. Implies <code>--color</code>.</p> |
| 999 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1000 | <dt class="hdlist1"><code>plain</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1001 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1002 | <p>Show words as [<code>-removed-</code>] and {<code>added</code>}. Makes no |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1003 | attempts to escape the delimiters if they appear in the input, |
| 1004 | so the output may be ambiguous.</p> |
| 1005 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1006 | <dt class="hdlist1"><code>porcelain</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1007 | <dd> |
| 1008 | <p>Use a special line-based format intended for script |
| 1009 | consumption. Added/removed/unchanged runs are printed in the |
| 1010 | usual unified diff format, starting with a <code>+</code>/<code>-</code>/` ` |
| 1011 | character at the beginning of the line and extending to the |
| 1012 | end of the line. Newlines in the input are represented by a |
| 1013 | tilde <code>~</code> on a line of its own.</p> |
| 1014 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1015 | <dt class="hdlist1"><code>none</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1016 | <dd> |
| 1017 | <p>Disable word diff again.</p> |
| 1018 | </dd> |
| 1019 | </dl> |
| 1020 | </div> |
| 1021 | </div> |
| 1022 | </div> |
| 1023 | <div class="paragraph"> |
| 1024 | <p>Note that despite the name of the first mode, color is used to |
| 1025 | highlight the changed parts in all modes if enabled.</p> |
| 1026 | </div> |
| 1027 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1028 | <dt class="hdlist1"><code>--word-diff-regex=</code><em><regex></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1029 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1030 | <p>Use <em><regex></em> to decide what a word is, instead of considering |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1031 | runs of non-whitespace to be a word. Also implies |
| 1032 | <code>--word-diff</code> unless it was already enabled.</p> |
| 1033 | <div class="paragraph"> |
| 1034 | <p>Every non-overlapping match of the |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1035 | <em><regex></em> is considered a word. Anything between these matches is |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1036 | considered whitespace and ignored(!) for the purposes of finding |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 1037 | differences. You may want to append |[<code>^</code>[<code>:space:</code>]] to your regular |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1038 | expression to make sure that it matches all non-whitespace characters. |
| 1039 | A match that contains a newline is silently truncated(!) at the |
| 1040 | newline.</p> |
| 1041 | </div> |
| 1042 | <div class="paragraph"> |
| 1043 | <p>For example, <code>--word-diff-regex=.</code> will treat each character as a word |
| 1044 | and, correspondingly, show differences character by character.</p> |
| 1045 | </div> |
| 1046 | <div class="paragraph"> |
| 1047 | <p>The regex can also be set via a diff driver or configuration option, see |
| 1048 | <a href="gitattributes.html">gitattributes(5)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly |
| 1049 | overrides any diff driver or configuration setting. Diff drivers |
| 1050 | override configuration settings.</p> |
| 1051 | </div> |
| 1052 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1053 | <dt class="hdlist1"><code>--color-words</code>[<code>=</code><em><regex></em>]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1054 | <dd> |
| 1055 | <p>Equivalent to <code>--word-diff=color</code> plus (if a regex was |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 1056 | specified) <code>--word-diff-regex=</code><em><regex></em>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1057 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1058 | <dt class="hdlist1"><code>--no-renames</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1059 | <dd> |
| 1060 | <p>Turn off rename detection, even when the configuration |
| 1061 | file gives the default to do so.</p> |
| 1062 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1063 | <dt class="hdlist1"><code>--</code>[<code>no-</code>]<code>rename-empty</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1064 | <dd> |
| 1065 | <p>Whether to use empty blobs as rename source.</p> |
| 1066 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1067 | <dt class="hdlist1"><code>--check</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1068 | <dd> |
| 1069 | <p>Warn if changes introduce conflict markers or whitespace errors. |
| 1070 | What are considered whitespace errors is controlled by <code>core.whitespace</code> |
| 1071 | configuration. By default, trailing whitespaces (including |
| 1072 | lines that consist solely of whitespaces) and a space character |
| 1073 | that is immediately followed by a tab character inside the |
| 1074 | initial indent of the line are considered whitespace errors. |
| 1075 | Exits with non-zero status if problems are found. Not compatible |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1076 | with <code>--exit-code</code>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1077 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1078 | <dt class="hdlist1"><code>--ws-error-highlight=</code><em><kind></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1079 | <dd> |
| 1080 | <p>Highlight whitespace errors in the <code>context</code>, <code>old</code> or <code>new</code> |
| 1081 | lines of the diff. Multiple values are separated by comma, |
| 1082 | <code>none</code> resets previous values, <code>default</code> reset the list to |
| 1083 | <code>new</code> and <code>all</code> is a shorthand for <code>old,new,context</code>. When |
| 1084 | this option is not given, and the configuration variable |
| 1085 | <code>diff.wsErrorHighlight</code> is not set, only whitespace errors in |
| 1086 | <code>new</code> lines are highlighted. The whitespace errors are colored |
| 1087 | with <code>color.diff.whitespace</code>.</p> |
| 1088 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1089 | <dt class="hdlist1"><code>--full-index</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1090 | <dd> |
| 1091 | <p>Instead of the first handful of characters, show the full |
| 1092 | pre- and post-image blob object names on the "index" |
| 1093 | line when generating patch format output.</p> |
| 1094 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1095 | <dt class="hdlist1"><code>--binary</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1096 | <dd> |
| 1097 | <p>In addition to <code>--full-index</code>, output a binary diff that |
| 1098 | can be applied with <code>git-apply</code>. |
| 1099 | Implies <code>--patch</code>.</p> |
| 1100 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1101 | <dt class="hdlist1"><code>--abbrev</code>[<code>=</code><em><n></em>]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1102 | <dd> |
| 1103 | <p>Instead of showing the full 40-byte hexadecimal object |
| 1104 | name in diff-raw format output and diff-tree header |
| 1105 | lines, show the shortest prefix that is at least <em><n></em> |
| 1106 | hexdigits long that uniquely refers the object. |
| 1107 | In diff-patch output format, <code>--full-index</code> takes higher |
| 1108 | precedence, i.e. if <code>--full-index</code> is specified, full blob |
| 1109 | names will be shown regardless of <code>--abbrev</code>. |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 1110 | Non default number of digits can be specified with <code>--abbrev=</code><em><n></em>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1111 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1112 | <dt class="hdlist1"><code>-B</code>[<em><n></em>][<code>/</code><em><m></em>]</dt> |
| 1113 | <dt class="hdlist1"><code>--break-rewrites</code>[<code>=</code>[<em><n></em>][<code>/</code><em><m></em>]]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1114 | <dd> |
| 1115 | <p>Break complete rewrite changes into pairs of delete and |
| 1116 | create. This serves two purposes:</p> |
| 1117 | <div class="paragraph"> |
| 1118 | <p>It affects the way a change that amounts to a total rewrite of a file |
| 1119 | not as a series of deletion and insertion mixed together with a very |
| 1120 | few lines that happen to match textually as the context, but as a |
| 1121 | single deletion of everything old followed by a single insertion of |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1122 | everything new, and the number <em><m></em> controls this aspect of the <code>-B</code> |
Junio C Hamano | a83f912 | 2025-07-21 21:51:14 | [diff] [blame] | 1123 | option (defaults to 60%). <code>-B/70%</code> specifies that less than 30% of the |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1124 | original should remain in the result for Git to consider it a total |
| 1125 | rewrite (i.e. otherwise the resulting patch will be a series of |
| 1126 | deletion and insertion mixed together with context lines).</p> |
| 1127 | </div> |
| 1128 | <div class="paragraph"> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1129 | <p>When used with <code>-M</code>, a totally-rewritten file is also considered as the |
| 1130 | source of a rename (usually <code>-M</code> only considers a file that disappeared |
| 1131 | as the source of a rename), and the number <em><n></em> controls this aspect of |
Junio C Hamano | a83f912 | 2025-07-21 21:51:14 | [diff] [blame] | 1132 | the <code>-B</code> option (defaults to 50%). <code>-B20%</code> specifies that a change with |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1133 | addition and deletion compared to 20% or more of the file’s size are |
| 1134 | eligible for being picked up as a possible source of a rename to |
| 1135 | another file.</p> |
| 1136 | </div> |
| 1137 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1138 | <dt class="hdlist1"><code>-M</code>[<em><n></em>]</dt> |
| 1139 | <dt class="hdlist1"><code>--find-renames</code>[<code>=</code><em><n></em>]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1140 | <dd> |
| 1141 | <p>Detect renames. |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1142 | If <em><n></em> is specified, it is a threshold on the similarity |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1143 | index (i.e. amount of addition/deletions compared to the |
Junio C Hamano | a83f912 | 2025-07-21 21:51:14 | [diff] [blame] | 1144 | file’s size). For example, <code>-M90%</code> means Git should consider a |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1145 | delete/add pair to be a rename if more than 90% of the file |
Junio C Hamano | a83f912 | 2025-07-21 21:51:14 | [diff] [blame] | 1146 | hasn’t changed. Without a <code>%</code> sign, the number is to be read as |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1147 | a fraction, with a decimal point before it. I.e., <code>-M5</code> becomes |
Junio C Hamano | a83f912 | 2025-07-21 21:51:14 | [diff] [blame] | 1148 | 0.5, and is thus the same as <code>-M50%</code>. Similarly, <code>-M05</code> is |
| 1149 | the same as <code>-M5%</code>. To limit detection to exact renames, use |
| 1150 | <code>-M100%</code>. The default similarity index is 50%.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1151 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1152 | <dt class="hdlist1"><code>-C</code>[<em><n></em>]</dt> |
| 1153 | <dt class="hdlist1"><code>--find-copies</code>[<code>=</code><em><n></em>]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1154 | <dd> |
| 1155 | <p>Detect copies as well as renames. See also <code>--find-copies-harder</code>. |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1156 | If <em><n></em> is specified, it has the same meaning as for <code>-M</code><em><n></em>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1157 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1158 | <dt class="hdlist1"><code>--find-copies-harder</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1159 | <dd> |
| 1160 | <p>For performance reasons, by default, <code>-C</code> option finds copies only |
| 1161 | if the original file of the copy was modified in the same |
| 1162 | changeset. This flag makes the command |
| 1163 | inspect unmodified files as candidates for the source of |
| 1164 | copy. This is a very expensive operation for large |
| 1165 | projects, so use it with caution. Giving more than one |
| 1166 | <code>-C</code> option has the same effect.</p> |
| 1167 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1168 | <dt class="hdlist1"><code>-D</code></dt> |
| 1169 | <dt class="hdlist1"><code>--irreversible-delete</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1170 | <dd> |
| 1171 | <p>Omit the preimage for deletes, i.e. print only the header but not |
| 1172 | the diff between the preimage and <code>/dev/null</code>. The resulting patch |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 1173 | is not meant to be applied with <code>patch</code> or <code>git</code> <code>apply</code>; this is |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1174 | solely for people who want to just concentrate on reviewing the |
| 1175 | text after the change. In addition, the output obviously lacks |
| 1176 | enough information to apply such a patch in reverse, even manually, |
| 1177 | hence the name of the option.</p> |
| 1178 | <div class="paragraph"> |
| 1179 | <p>When used together with <code>-B</code>, omit also the preimage in the deletion part |
| 1180 | of a delete/create pair.</p> |
| 1181 | </div> |
| 1182 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1183 | <dt class="hdlist1"><code>-l</code><em><num></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1184 | <dd> |
| 1185 | <p>The <code>-M</code> and <code>-C</code> options involve some preliminary steps that |
| 1186 | can detect subsets of renames/copies cheaply, followed by an |
| 1187 | exhaustive fallback portion that compares all remaining |
| 1188 | unpaired destinations to all relevant sources. (For renames, |
| 1189 | only remaining unpaired sources are relevant; for copies, all |
| 1190 | original sources are relevant.) For N sources and |
| 1191 | destinations, this exhaustive check is O(N^2). This option |
| 1192 | prevents the exhaustive portion of rename/copy detection from |
| 1193 | running if the number of source/destination files involved |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1194 | exceeds the specified number. Defaults to <code>diff.renameLimit</code>. |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1195 | Note that a value of 0 is treated as unlimited.</p> |
| 1196 | </dd> |
Junio C Hamano | e03f599 | 2025-04-23 22:24:29 | [diff] [blame] | 1197 | <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 Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1198 | <dd> |
| 1199 | <p>Select only files that are Added (<code>A</code>), Copied (<code>C</code>), |
| 1200 | Deleted (<code>D</code>), Modified (<code>M</code>), Renamed (<code>R</code>), have their |
| 1201 | type (i.e. regular file, symlink, submodule, …​) changed (<code>T</code>), |
| 1202 | are Unmerged (<code>U</code>), are |
| 1203 | Unknown (<code>X</code>), or have had their pairing Broken (<code>B</code>). |
| 1204 | Any combination of the filter characters (including none) can be used. |
Junio C Hamano | e03f599 | 2025-04-23 22:24:29 | [diff] [blame] | 1205 | When <code>*</code> (All-or-none) is added to the combination, all |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1206 | paths are selected if there is any file that matches |
| 1207 | other criteria in the comparison; if there is no file |
| 1208 | that matches other criteria, nothing is selected.</p> |
| 1209 | <div class="paragraph"> |
| 1210 | <p>Also, these upper-case letters can be downcased to exclude. E.g. |
| 1211 | <code>--diff-filter=ad</code> excludes added and deleted paths.</p> |
| 1212 | </div> |
| 1213 | <div class="paragraph"> |
| 1214 | <p>Note that not all diffs can feature all types. For instance, copied and |
| 1215 | renamed entries cannot appear if detection for those types is disabled.</p> |
| 1216 | </div> |
| 1217 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1218 | <dt class="hdlist1"><code>-S</code><em><string></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1219 | <dd> |
| 1220 | <p>Look for differences that change the number of occurrences of |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1221 | the specified <em><string></em> (i.e. addition/deletion) in a file. |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1222 | Intended for the scripter’s use.</p> |
| 1223 | <div class="paragraph"> |
| 1224 | <p>It is useful when you’re looking for an exact block of code (like a |
| 1225 | struct), and want to know the history of that block since it first |
| 1226 | came into being: use the feature iteratively to feed the interesting |
| 1227 | block in the preimage back into <code>-S</code>, and keep going until you get the |
| 1228 | very first version of the block.</p> |
| 1229 | </div> |
| 1230 | <div class="paragraph"> |
| 1231 | <p>Binary files are searched as well.</p> |
| 1232 | </div> |
| 1233 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1234 | <dt class="hdlist1"><code>-G</code><em><regex></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1235 | <dd> |
| 1236 | <p>Look for differences whose patch text contains added/removed |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1237 | lines that match <em><regex></em>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1238 | <div class="paragraph"> |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 1239 | <p>To illustrate the difference between <code>-S</code><em><regex></em> <code>--pickaxe-regex</code> and |
| 1240 | <code>-G</code><em><regex></em>, consider a commit with the following diff in the same |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1241 | file:</p> |
| 1242 | </div> |
| 1243 | <div class="listingblock"> |
| 1244 | <div class="content"> |
| 1245 | <pre>+ return frotz(nitfol, two->ptr, 1, 0); |
| 1246 | ... |
| 1247 | - hit = frotz(nitfol, mf2.ptr, 1, 0);</pre> |
| 1248 | </div> |
| 1249 | </div> |
| 1250 | <div class="paragraph"> |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 1251 | <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> |
| 1252 | <code>-S</code>"frotz\(<code>nitfol</code>" <code>--pickaxe-regex</code> will not (because the number of |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1253 | occurrences of that string did not change).</p> |
| 1254 | </div> |
| 1255 | <div class="paragraph"> |
| 1256 | <p>Unless <code>--text</code> is supplied patches of binary files without a textconv |
| 1257 | filter will be ignored.</p> |
| 1258 | </div> |
| 1259 | <div class="paragraph"> |
| 1260 | <p>See the <em>pickaxe</em> entry in <a href="gitdiffcore.html">gitdiffcore(7)</a> for more |
| 1261 | information.</p> |
| 1262 | </div> |
| 1263 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1264 | <dt class="hdlist1"><code>--find-object=</code><em><object-id></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1265 | <dd> |
| 1266 | <p>Look for differences that change the number of occurrences of |
| 1267 | the specified object. Similar to <code>-S</code>, just the argument is different |
| 1268 | in that it doesn’t search for a specific string but for a specific |
| 1269 | object id.</p> |
| 1270 | <div class="paragraph"> |
| 1271 | <p>The object can be a blob or a submodule commit. It implies the <code>-t</code> option in |
| 1272 | <code>git-log</code> to also find trees.</p> |
| 1273 | </div> |
| 1274 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1275 | <dt class="hdlist1"><code>--pickaxe-all</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1276 | <dd> |
| 1277 | <p>When <code>-S</code> or <code>-G</code> finds a change, show all the changes in that |
| 1278 | changeset, not just the files that contain the change |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1279 | in <em><string></em>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1280 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1281 | <dt class="hdlist1"><code>--pickaxe-regex</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1282 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1283 | <p>Treat the <em><string></em> given to <code>-S</code> as an extended POSIX regular |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1284 | expression to match.</p> |
| 1285 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1286 | <dt class="hdlist1"><code>-O</code><em><orderfile></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1287 | <dd> |
| 1288 | <p>Control the order in which files appear in the output. |
| 1289 | This overrides the <code>diff.orderFile</code> configuration variable |
| 1290 | (see <a href="git-config.html">git-config(1)</a>). To cancel <code>diff.orderFile</code>, |
| 1291 | use <code>-O/dev/null</code>.</p> |
| 1292 | <div class="paragraph"> |
| 1293 | <p>The output order is determined by the order of glob patterns in |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1294 | <em><orderfile></em>. |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1295 | All files with pathnames that match the first pattern are output |
| 1296 | first, all files with pathnames that match the second pattern (but not |
| 1297 | the first) are output next, and so on. |
| 1298 | All files with pathnames that do not match any pattern are output |
| 1299 | last, as if there was an implicit match-all pattern at the end of the |
| 1300 | file. |
| 1301 | If multiple pathnames have the same rank (they match the same pattern |
| 1302 | but no earlier patterns), their output order relative to each other is |
| 1303 | the normal order.</p> |
| 1304 | </div> |
| 1305 | <div class="paragraph"> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1306 | <p><em><orderfile></em> is parsed as follows:</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1307 | </div> |
| 1308 | <div class="openblock"> |
| 1309 | <div class="content"> |
| 1310 | <div class="ulist"> |
| 1311 | <ul> |
| 1312 | <li> |
| 1313 | <p>Blank lines are ignored, so they can be used as separators for |
| 1314 | readability.</p> |
| 1315 | </li> |
| 1316 | <li> |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 1317 | <p>Lines starting with a hash ("#") are ignored, so they can be used |
Junio C Hamano | e03f599 | 2025-04-23 22:24:29 | [diff] [blame] | 1318 | for comments. Add a backslash ("<code>\</code>") to the beginning of the |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1319 | pattern if it starts with a hash.</p> |
| 1320 | </li> |
| 1321 | <li> |
| 1322 | <p>Each other line contains a single pattern.</p> |
| 1323 | </li> |
| 1324 | </ul> |
| 1325 | </div> |
| 1326 | </div> |
| 1327 | </div> |
| 1328 | <div class="paragraph"> |
| 1329 | <p>Patterns have the same syntax and semantics as patterns used for |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1330 | <code>fnmatch</code>(3) without the <code>FNM_PATHNAME</code> flag, except a pathname also |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1331 | matches a pattern if removing any number of the final pathname |
Junio C Hamano | e03f599 | 2025-04-23 22:24:29 | [diff] [blame] | 1332 | components matches the pattern. For example, the pattern "<code>foo*bar</code>" |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1333 | matches "<code>fooasdfbar</code>" and "<code>foo/bar/baz/asdf</code>" but not "<code>foobarx</code>".</p> |
| 1334 | </div> |
| 1335 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1336 | <dt class="hdlist1"><code>--skip-to=</code><em><file></em></dt> |
| 1337 | <dt class="hdlist1"><code>--rotate-to=</code><em><file></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1338 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1339 | <p>Discard the files before the named <em><file></em> from the output |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1340 | (i.e. <em>skip to</em>), or move them to the end of the output |
| 1341 | (i.e. <em>rotate to</em>). These options were invented primarily for the use |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 1342 | of the <code>git</code> <code>difftool</code> command, and may not be very useful |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1343 | otherwise.</p> |
| 1344 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1345 | <dt class="hdlist1"><code>-R</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1346 | <dd> |
| 1347 | <p>Swap two inputs; that is, show differences from index or |
| 1348 | on-disk file to tree contents.</p> |
| 1349 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1350 | <dt class="hdlist1"><code>--relative</code>[<code>=</code><em><path></em>]</dt> |
| 1351 | <dt class="hdlist1"><code>--no-relative</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1352 | <dd> |
| 1353 | <p>When run from a subdirectory of the project, it can be |
| 1354 | told to exclude changes outside the directory and show |
| 1355 | pathnames relative to it with this option. When you are |
| 1356 | not in a subdirectory (e.g. in a bare repository), you |
| 1357 | can name which subdirectory to make the output relative |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1358 | to by giving a <em><path></em> as an argument. |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1359 | <code>--no-relative</code> can be used to countermand both <code>diff.relative</code> config |
| 1360 | option and previous <code>--relative</code>.</p> |
| 1361 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1362 | <dt class="hdlist1"><code>-a</code></dt> |
| 1363 | <dt class="hdlist1"><code>--text</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1364 | <dd> |
| 1365 | <p>Treat all files as text.</p> |
| 1366 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1367 | <dt class="hdlist1"><code>--ignore-cr-at-eol</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1368 | <dd> |
| 1369 | <p>Ignore carriage-return at the end of line when doing a comparison.</p> |
| 1370 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1371 | <dt class="hdlist1"><code>--ignore-space-at-eol</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1372 | <dd> |
| 1373 | <p>Ignore changes in whitespace at EOL.</p> |
| 1374 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1375 | <dt class="hdlist1"><code>-b</code></dt> |
| 1376 | <dt class="hdlist1"><code>--ignore-space-change</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1377 | <dd> |
| 1378 | <p>Ignore changes in amount of whitespace. This ignores whitespace |
| 1379 | at line end, and considers all other sequences of one or |
| 1380 | more whitespace characters to be equivalent.</p> |
| 1381 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1382 | <dt class="hdlist1"><code>-w</code></dt> |
| 1383 | <dt class="hdlist1"><code>--ignore-all-space</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1384 | <dd> |
| 1385 | <p>Ignore whitespace when comparing lines. This ignores |
| 1386 | differences even if one line has whitespace where the other |
| 1387 | line has none.</p> |
| 1388 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1389 | <dt class="hdlist1"><code>--ignore-blank-lines</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1390 | <dd> |
| 1391 | <p>Ignore changes whose lines are all blank.</p> |
| 1392 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1393 | <dt class="hdlist1"><code>-I</code><em><regex></em></dt> |
| 1394 | <dt class="hdlist1"><code>--ignore-matching-lines=</code><em><regex></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1395 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1396 | <p>Ignore changes whose all lines match <em><regex></em>. This option may |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1397 | be specified more than once.</p> |
| 1398 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1399 | <dt class="hdlist1"><code>--inter-hunk-context=</code><em><number></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1400 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1401 | <p>Show the context between diff hunks, up to the specified <em><number></em> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1402 | of lines, thereby fusing hunks that are close to each other. |
| 1403 | Defaults to <code>diff.interHunkContext</code> or 0 if the config option |
| 1404 | is unset.</p> |
| 1405 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1406 | <dt class="hdlist1"><code>-W</code></dt> |
| 1407 | <dt class="hdlist1"><code>--function-context</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1408 | <dd> |
| 1409 | <p>Show whole function as context lines for each change. |
| 1410 | The function names are determined in the same way as |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1411 | <code>git</code> <code>diff</code> works out patch hunk headers (see "Defining a |
| 1412 | custom hunk-header" in <a href="gitattributes.html">gitattributes(5)</a>).</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1413 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1414 | <dt class="hdlist1"><code>--exit-code</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1415 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1416 | <p>Make the program exit with codes similar to <code>diff</code>(1). |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1417 | That is, it exits with 1 if there were differences and |
| 1418 | 0 means no differences.</p> |
| 1419 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1420 | <dt class="hdlist1"><code>--quiet</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1421 | <dd> |
| 1422 | <p>Disable all output of the program. Implies <code>--exit-code</code>. |
| 1423 | Disables execution of external diff helpers whose exit code |
| 1424 | is not trusted, i.e. their respective configuration option |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1425 | <code>diff.trustExitCode</code> or <code>diff.</code><em><driver></em>.<code>trustExitCode</code> or |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1426 | environment variable <code>GIT_EXTERNAL_DIFF_TRUST_EXIT_CODE</code> is |
| 1427 | false.</p> |
| 1428 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1429 | <dt class="hdlist1"><code>--ext-diff</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1430 | <dd> |
| 1431 | <p>Allow an external diff helper to be executed. If you set an |
| 1432 | external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need |
| 1433 | to use this option with <a href="git-log.html">git-log(1)</a> and friends.</p> |
| 1434 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1435 | <dt class="hdlist1"><code>--no-ext-diff</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1436 | <dd> |
| 1437 | <p>Disallow external diff drivers.</p> |
| 1438 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1439 | <dt class="hdlist1"><code>--textconv</code></dt> |
| 1440 | <dt class="hdlist1"><code>--no-textconv</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1441 | <dd> |
| 1442 | <p>Allow (or disallow) external text conversion filters to be run |
| 1443 | when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for |
| 1444 | details. Because textconv filters are typically a one-way |
| 1445 | conversion, the resulting diff is suitable for human |
| 1446 | consumption, but cannot be applied. For this reason, textconv |
| 1447 | filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and |
| 1448 | <a href="git-log.html">git-log(1)</a>, but not for <a href="git-format-patch.html">git-format-patch(1)</a> or |
| 1449 | diff plumbing commands.</p> |
| 1450 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1451 | <dt class="hdlist1"><code>--ignore-submodules</code>[<code>=</code>(<code>none</code>|<code>untracked</code>|<code>dirty</code>|<code>all</code>)]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1452 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1453 | <p>Ignore changes to submodules in the diff generation. <code>all</code> is the default. |
| 1454 | Using <code>none</code> will consider the submodule modified when it either contains |
| 1455 | untracked or modified files or its <code>HEAD</code> differs from the commit recorded |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1456 | in the superproject and can be used to override any settings of the |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1457 | <code>ignore</code> option in <a href="git-config.html">git-config(1)</a> or <a href="gitmodules.html">gitmodules(5)</a>. When |
| 1458 | <code>untracked</code> is used submodules are not considered dirty when they only |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1459 | contain untracked content (but they are still scanned for modified |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1460 | content). Using <code>dirty</code> ignores all changes to the work tree of submodules, |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1461 | only changes to the commits stored in the superproject are shown (this was |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1462 | the behavior until 1.7.0). Using <code>all</code> hides all changes to submodules.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1463 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1464 | <dt class="hdlist1"><code>--src-prefix=</code><em><prefix></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1465 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1466 | <p>Show the given source <em><prefix></em> instead of "a/".</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1467 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1468 | <dt class="hdlist1"><code>--dst-prefix=</code><em><prefix></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1469 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1470 | <p>Show the given destination <em><prefix></em> instead of "b/".</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1471 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1472 | <dt class="hdlist1"><code>--no-prefix</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1473 | <dd> |
| 1474 | <p>Do not show any source or destination prefix.</p> |
| 1475 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1476 | <dt class="hdlist1"><code>--default-prefix</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1477 | <dd> |
| 1478 | <p>Use the default source and destination prefixes ("a/" and "b/"). |
| 1479 | This overrides configuration variables such as <code>diff.noprefix</code>, |
| 1480 | <code>diff.srcPrefix</code>, <code>diff.dstPrefix</code>, and <code>diff.mnemonicPrefix</code> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1481 | (see <a href="git-config.html">git-config(1)</a>).</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1482 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1483 | <dt class="hdlist1"><code>--line-prefix=</code><em><prefix></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1484 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1485 | <p>Prepend an additional <em><prefix></em> to every line of output.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1486 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1487 | <dt class="hdlist1"><code>--ita-invisible-in-index</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1488 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1489 | <p>By default entries added by <code>git</code> <code>add</code> <code>-N</code> appear as an existing |
| 1490 | empty file in <code>git</code> <code>diff</code> and a new file in <code>git</code> <code>diff</code> <code>--cached</code>. |
| 1491 | This option makes the entry appear as a new file in <code>git</code> <code>diff</code> |
| 1492 | and non-existent in <code>git</code> <code>diff</code> <code>--cached</code>. This option could be |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1493 | reverted with <code>--ita-visible-in-index</code>. Both options are |
| 1494 | experimental and could be removed in future.</p> |
| 1495 | </dd> |
| 1496 | </dl> |
| 1497 | </div> |
| 1498 | <div class="paragraph"> |
| 1499 | <p>For more detailed explanation on these common options, see also |
| 1500 | <a href="gitdiffcore.html">gitdiffcore(7)</a>.</p> |
| 1501 | </div> |
| 1502 | <div class="dlist"> |
| 1503 | <dl> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1504 | <dt class="hdlist1"><code>-1</code></dt> |
| 1505 | <dt class="hdlist1"><code>--base</code></dt> |
| 1506 | <dt class="hdlist1"><code>-2</code></dt> |
| 1507 | <dt class="hdlist1"><code>--ours</code></dt> |
| 1508 | <dt class="hdlist1"><code>-3</code></dt> |
| 1509 | <dt class="hdlist1"><code>--theirs</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1510 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1511 | <p>Compare the working tree with</p> |
| 1512 | <div class="openblock"> |
| 1513 | <div class="content"> |
| 1514 | <div class="ulist"> |
| 1515 | <ul> |
| 1516 | <li> |
| 1517 | <p>the "base" version (stage #1) when using <code>-1</code> or <code>--base</code>,</p> |
| 1518 | </li> |
| 1519 | <li> |
| 1520 | <p>"our branch" (stage #2) when using <code>-2</code> or <code>--ours</code>, or</p> |
| 1521 | </li> |
| 1522 | <li> |
| 1523 | <p>"their branch" (stage #3) when using <code>-3</code> or <code>--theirs</code>.</p> |
| 1524 | </li> |
| 1525 | </ul> |
| 1526 | </div> |
| 1527 | </div> |
| 1528 | </div> |
| 1529 | <div class="paragraph"> |
| 1530 | <p>The index contains these stages only for unmerged entries i.e. |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1531 | while resolving conflicts. See <a href="git-read-tree.html">git-read-tree(1)</a> |
| 1532 | section "3-Way Merge" for detailed information.</p> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1533 | </div> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1534 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1535 | <dt class="hdlist1"><code>-0</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1536 | <dd> |
| 1537 | <p>Omit diff output for unmerged entries and just show |
| 1538 | "Unmerged". Can be used only when comparing the working tree |
| 1539 | with the index.</p> |
| 1540 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1541 | <dt class="hdlist1"><em><path></em>...</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1542 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1543 | <p>The <em><path></em> parameters, when given, are used to limit |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1544 | the diff to the named paths (you can give directory |
| 1545 | names and get diff for all files under them).</p> |
| 1546 | </dd> |
| 1547 | </dl> |
| 1548 | </div> |
| 1549 | </div> |
| 1550 | </div> |
| 1551 | <div class="sect1"> |
| 1552 | <h2 id="_raw_output_format">Raw output format</h2> |
| 1553 | <div class="sectionbody"> |
| 1554 | <div class="paragraph"> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1555 | <p>The raw output format from <code>git-diff-index</code>, <code>git-diff-tree</code>, |
| 1556 | <code>git-diff-files</code> and <code>git</code> <code>diff</code> <code>--raw</code> are very similar.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1557 | </div> |
| 1558 | <div class="paragraph"> |
| 1559 | <p>These commands all compare two sets of things; what is |
| 1560 | compared differs:</p> |
| 1561 | </div> |
| 1562 | <div class="dlist"> |
| 1563 | <dl> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1564 | <dt class="hdlist1"><code>git-diff-index</code> <em><tree-ish></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1565 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1566 | <p>compares the <em><tree-ish></em> and the files on the filesystem.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1567 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1568 | <dt class="hdlist1"><code>git-diff-index</code> <code>--cached</code> <em><tree-ish></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1569 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1570 | <p>compares the <em><tree-ish></em> and the index.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1571 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1572 | <dt class="hdlist1"><code>git-diff-tree</code> [<code>-r</code>] <em><tree-ish-1></em> <em><tree-ish-2></em> [<em><pattern></em>...]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1573 | <dd> |
| 1574 | <p>compares the trees named by the two arguments.</p> |
| 1575 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1576 | <dt class="hdlist1"><code>git-diff-files</code> [<em><pattern></em>...]</dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1577 | <dd> |
| 1578 | <p>compares the index and the files on the filesystem.</p> |
| 1579 | </dd> |
| 1580 | </dl> |
| 1581 | </div> |
| 1582 | <div class="paragraph"> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1583 | <p>The <code>git-diff-tree</code> command begins its output by printing the hash of |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1584 | what is being compared. After that, all the commands print one output |
| 1585 | line per changed file.</p> |
| 1586 | </div> |
| 1587 | <div class="paragraph"> |
| 1588 | <p>An output line is formatted this way:</p> |
| 1589 | </div> |
| 1590 | <div class="listingblock"> |
| 1591 | <div class="content"> |
| 1592 | <pre>in-place edit :100644 100644 bcd1234 0123456 M file0 |
| 1593 | copy-edit :100644 100644 abcd123 1234567 C68 file1 file2 |
| 1594 | rename-edit :100644 100644 abcd123 1234567 R86 file1 file3 |
| 1595 | create :000000 100644 0000000 1234567 A file4 |
| 1596 | delete :100644 000000 1234567 0000000 D file5 |
| 1597 | unmerged :000000 000000 0000000 0000000 U file6</pre> |
| 1598 | </div> |
| 1599 | </div> |
| 1600 | <div class="paragraph"> |
| 1601 | <p>That is, from the left to the right:</p> |
| 1602 | </div> |
| 1603 | <div class="olist arabic"> |
| 1604 | <ol class="arabic"> |
| 1605 | <li> |
| 1606 | <p>a colon.</p> |
| 1607 | </li> |
| 1608 | <li> |
| 1609 | <p>mode for "src"; 000000 if creation or unmerged.</p> |
| 1610 | </li> |
| 1611 | <li> |
| 1612 | <p>a space.</p> |
| 1613 | </li> |
| 1614 | <li> |
| 1615 | <p>mode for "dst"; 000000 if deletion or unmerged.</p> |
| 1616 | </li> |
| 1617 | <li> |
| 1618 | <p>a space.</p> |
| 1619 | </li> |
| 1620 | <li> |
| 1621 | <p>sha1 for "src"; 0{40} if creation or unmerged.</p> |
| 1622 | </li> |
| 1623 | <li> |
| 1624 | <p>a space.</p> |
| 1625 | </li> |
| 1626 | <li> |
| 1627 | <p>sha1 for "dst"; 0{40} if deletion, unmerged or "work tree out of sync with the index".</p> |
| 1628 | </li> |
| 1629 | <li> |
| 1630 | <p>a space.</p> |
| 1631 | </li> |
| 1632 | <li> |
| 1633 | <p>status, followed by optional "score" number.</p> |
| 1634 | </li> |
| 1635 | <li> |
| 1636 | <p>a tab or a NUL when <code>-z</code> option is used.</p> |
| 1637 | </li> |
| 1638 | <li> |
| 1639 | <p>path for "src"</p> |
| 1640 | </li> |
| 1641 | <li> |
| 1642 | <p>a tab or a NUL when <code>-z</code> option is used; only exists for C or R.</p> |
| 1643 | </li> |
| 1644 | <li> |
| 1645 | <p>path for "dst"; only exists for C or R.</p> |
| 1646 | </li> |
| 1647 | <li> |
| 1648 | <p>an LF or a NUL when <code>-z</code> option is used, to terminate the record.</p> |
| 1649 | </li> |
| 1650 | </ol> |
| 1651 | </div> |
| 1652 | <div class="paragraph"> |
| 1653 | <p>Possible status letters are:</p> |
| 1654 | </div> |
| 1655 | <div class="ulist"> |
| 1656 | <ul> |
| 1657 | <li> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1658 | <p><code>A</code>: addition of a file</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1659 | </li> |
| 1660 | <li> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1661 | <p><code>C</code>: copy of a file into a new one</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1662 | </li> |
| 1663 | <li> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1664 | <p><code>D</code>: deletion of a file</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1665 | </li> |
| 1666 | <li> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1667 | <p><code>M</code>: modification of the contents or mode of a file</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1668 | </li> |
| 1669 | <li> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1670 | <p><code>R</code>: renaming of a file</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1671 | </li> |
| 1672 | <li> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1673 | <p><code>T</code>: change in the type of the file (regular file, symbolic link or submodule)</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1674 | </li> |
| 1675 | <li> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1676 | <p><code>U</code>: file is unmerged (you must complete the merge before it can |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1677 | be committed)</p> |
| 1678 | </li> |
| 1679 | <li> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1680 | <p><code>X</code>: "unknown" change type (most probably a bug, please report it)</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1681 | </li> |
| 1682 | </ul> |
| 1683 | </div> |
| 1684 | <div class="paragraph"> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1685 | <p>Status letters <code>C</code> and <code>R</code> are always followed by a score (denoting the |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1686 | percentage of similarity between the source and target of the move or |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1687 | copy). Status letter <code>M</code> may be followed by a score (denoting the |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1688 | percentage of dissimilarity) for file rewrites.</p> |
| 1689 | </div> |
| 1690 | <div class="paragraph"> |
| 1691 | <p>The sha1 for "dst" is shown as all 0’s if a file on the filesystem |
| 1692 | is out of sync with the index.</p> |
| 1693 | </div> |
| 1694 | <div class="paragraph"> |
| 1695 | <p>Example:</p> |
| 1696 | </div> |
| 1697 | <div class="listingblock"> |
| 1698 | <div class="content"> |
| 1699 | <pre>:100644 100644 5be4a4a 0000000 M file.c</pre> |
| 1700 | </div> |
| 1701 | </div> |
| 1702 | <div class="paragraph"> |
| 1703 | <p>Without the <code>-z</code> option, pathnames with "unusual" characters are |
| 1704 | quoted as explained for the configuration variable <code>core.quotePath</code> |
| 1705 | (see <a href="git-config.html">git-config(1)</a>). Using <code>-z</code> the filename is output |
| 1706 | verbatim and the line is terminated by a NUL byte.</p> |
| 1707 | </div> |
| 1708 | </div> |
| 1709 | </div> |
| 1710 | <div class="sect1"> |
| 1711 | <h2 id="_diff_format_for_merges">diff format for merges</h2> |
| 1712 | <div class="sectionbody"> |
| 1713 | <div class="paragraph"> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1714 | <p><code>git-diff-tree</code>, <code>git-diff-files</code> and <code>git-diff</code> <code>--raw</code> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1715 | can take <code>-c</code> or <code>--cc</code> option |
| 1716 | to generate diff output also for merge commits. The output differs |
| 1717 | from the format described above in the following way:</p> |
| 1718 | </div> |
| 1719 | <div class="olist arabic"> |
| 1720 | <ol class="arabic"> |
| 1721 | <li> |
| 1722 | <p>there is a colon for each parent</p> |
| 1723 | </li> |
| 1724 | <li> |
| 1725 | <p>there are more "src" modes and "src" sha1</p> |
| 1726 | </li> |
| 1727 | <li> |
| 1728 | <p>status is concatenated status characters for each parent</p> |
| 1729 | </li> |
| 1730 | <li> |
| 1731 | <p>no optional "score" number</p> |
| 1732 | </li> |
| 1733 | <li> |
| 1734 | <p>tab-separated pathname(s) of the file</p> |
| 1735 | </li> |
| 1736 | </ol> |
| 1737 | </div> |
| 1738 | <div class="paragraph"> |
| 1739 | <p>For <code>-c</code> and <code>--cc</code>, only the destination or final path is shown even |
| 1740 | if the file was renamed on any side of history. With |
| 1741 | <code>--combined-all-paths</code>, the name of the path in each parent is shown |
| 1742 | followed by the name of the path in the merge commit.</p> |
| 1743 | </div> |
| 1744 | <div class="paragraph"> |
| 1745 | <p>Examples for <code>-c</code> and <code>--cc</code> without <code>--combined-all-paths</code>:</p> |
| 1746 | </div> |
| 1747 | <div class="listingblock"> |
| 1748 | <div class="content"> |
| 1749 | <pre>::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc.c |
| 1750 | ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM bar.sh |
| 1751 | ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR phooey.c</pre> |
| 1752 | </div> |
| 1753 | </div> |
| 1754 | <div class="paragraph"> |
| 1755 | <p>Examples when <code>--combined-all-paths</code> added to either <code>-c</code> or <code>--cc</code>:</p> |
| 1756 | </div> |
| 1757 | <div class="listingblock"> |
| 1758 | <div class="content"> |
| 1759 | <pre>::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc.c desc.c desc.c |
| 1760 | ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM foo.sh bar.sh bar.sh |
| 1761 | ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR fooey.c fuey.c phooey.c</pre> |
| 1762 | </div> |
| 1763 | </div> |
| 1764 | <div class="paragraph"> |
| 1765 | <p>Note that <em>combined diff</em> lists only files which were modified from |
| 1766 | all parents.</p> |
| 1767 | </div> |
| 1768 | </div> |
| 1769 | </div> |
| 1770 | <div class="sect1"> |
| 1771 | <h2 id="generate_patch_text_with_p">Generating patch text with -p</h2> |
| 1772 | <div class="sectionbody"> |
| 1773 | <div class="paragraph"> |
| 1774 | <p>Running |
| 1775 | <a href="git-diff.html">git-diff(1)</a>, |
| 1776 | <a href="git-log.html">git-log(1)</a>, |
| 1777 | <a href="git-show.html">git-show(1)</a>, |
| 1778 | <a href="git-diff-index.html">git-diff-index(1)</a>, |
| 1779 | <a href="git-diff-tree.html">git-diff-tree(1)</a>, or |
| 1780 | <a href="git-diff-files.html">git-diff-files(1)</a> |
| 1781 | with the <code>-p</code> option produces patch text. |
| 1782 | You can customize the creation of patch text via the |
| 1783 | <code>GIT_EXTERNAL_DIFF</code> and the <code>GIT_DIFF_OPTS</code> environment variables |
| 1784 | (see <a href="git.html">git(1)</a>), and the <code>diff</code> attribute (see <a href="gitattributes.html">gitattributes(5)</a>).</p> |
| 1785 | </div> |
| 1786 | <div class="paragraph"> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1787 | <p>What the <code>-p</code> option produces is slightly different from the traditional |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1788 | diff format:</p> |
| 1789 | </div> |
| 1790 | <div class="olist arabic"> |
| 1791 | <ol class="arabic"> |
| 1792 | <li> |
| 1793 | <p>It is preceded by a "git diff" header that looks like this:</p> |
| 1794 | <div class="literalblock"> |
| 1795 | <div class="content"> |
| 1796 | <pre>diff --git a/file1 b/file2</pre> |
| 1797 | </div> |
| 1798 | </div> |
| 1799 | <div class="paragraph"> |
| 1800 | <p>The <code>a/</code> and <code>b/</code> filenames are the same unless rename/copy is |
| 1801 | involved. Especially, even for a creation or a deletion, |
| 1802 | <code>/dev/null</code> is <em>not</em> used in place of the <code>a/</code> or <code>b/</code> filenames.</p> |
| 1803 | </div> |
| 1804 | <div class="paragraph"> |
| 1805 | <p>When a rename/copy is involved, <code>file1</code> and <code>file2</code> show the |
| 1806 | name of the source file of the rename/copy and the name of |
| 1807 | the file that the rename/copy produces, respectively.</p> |
| 1808 | </div> |
| 1809 | </li> |
| 1810 | <li> |
| 1811 | <p>It is followed by one or more extended header lines:</p> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1812 | <div class="verseblock"> |
| 1813 | <pre class="content"><code>old</code> <code>mode</code> <em><mode></em> |
| 1814 | <code>new</code> <code>mode</code> <em><mode></em> |
| 1815 | <code>deleted</code> <code>file</code> <code>mode</code> <em><mode></em> |
| 1816 | <code>new</code> <code>file</code> <code>mode</code> <em><mode></em> |
| 1817 | <code>copy</code> <code>from</code> <em><path></em> |
| 1818 | <code>copy</code> <code>to</code> <em><path></em> |
| 1819 | <code>rename</code> <code>from</code> <em><path></em> |
| 1820 | <code>rename</code> <code>to</code> <em><path></em> |
| 1821 | <code>similarity</code> <code>index</code> <em><number></em> |
| 1822 | <code>dissimilarity</code> <code>index</code> <em><number></em> |
Junio C Hamano | e03f599 | 2025-04-23 22:24:29 | [diff] [blame] | 1823 | <code>index</code> <em><hash></em><code>..</code><em><hash></em> <em><mode></em></pre> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1824 | </div> |
| 1825 | <div class="paragraph"> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1826 | <p>File modes <em><mode></em> are printed as 6-digit octal numbers including the file type |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1827 | and file permission bits.</p> |
| 1828 | </div> |
| 1829 | <div class="paragraph"> |
| 1830 | <p>Path names in extended headers do not include the <code>a/</code> and <code>b/</code> prefixes.</p> |
| 1831 | </div> |
| 1832 | <div class="paragraph"> |
| 1833 | <p>The similarity index is the percentage of unchanged lines, and |
| 1834 | the dissimilarity index is the percentage of changed lines. It |
| 1835 | is a rounded down integer, followed by a percent sign. The |
| 1836 | similarity index value of 100% is thus reserved for two equal |
| 1837 | files, while 100% dissimilarity means that no line from the old |
| 1838 | file made it into the new one.</p> |
| 1839 | </div> |
| 1840 | <div class="paragraph"> |
| 1841 | <p>The index line includes the blob object names before and after the change. |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1842 | The <em><mode></em> is included if the file mode does not change; otherwise, |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1843 | separate lines indicate the old and the new mode.</p> |
| 1844 | </div> |
| 1845 | </li> |
| 1846 | <li> |
| 1847 | <p>Pathnames with "unusual" characters are quoted as explained for |
| 1848 | the configuration variable <code>core.quotePath</code> (see |
| 1849 | <a href="git-config.html">git-config(1)</a>).</p> |
| 1850 | </li> |
| 1851 | <li> |
| 1852 | <p>All the <code>file1</code> files in the output refer to files before the |
| 1853 | commit, and all the <code>file2</code> files refer to files after the commit. |
| 1854 | It is incorrect to apply each change to each file sequentially. For |
| 1855 | example, this patch will swap a and b:</p> |
| 1856 | <div class="literalblock"> |
| 1857 | <div class="content"> |
| 1858 | <pre>diff --git a/a b/b |
| 1859 | rename from a |
| 1860 | rename to b |
| 1861 | diff --git a/b b/a |
| 1862 | rename from b |
| 1863 | rename to a</pre> |
| 1864 | </div> |
| 1865 | </div> |
| 1866 | </li> |
| 1867 | <li> |
| 1868 | <p>Hunk headers mention the name of the function to which the hunk |
| 1869 | applies. See "Defining a custom hunk-header" in |
| 1870 | <a href="gitattributes.html">gitattributes(5)</a> for details of how to tailor this to |
| 1871 | specific languages.</p> |
| 1872 | </li> |
| 1873 | </ol> |
| 1874 | </div> |
| 1875 | </div> |
| 1876 | </div> |
| 1877 | <div class="sect1"> |
| 1878 | <h2 id="_combined_diff_format">Combined diff format</h2> |
| 1879 | <div class="sectionbody"> |
| 1880 | <div class="paragraph"> |
| 1881 | <p>Any diff-generating command can take the <code>-c</code> or <code>--cc</code> option to |
| 1882 | produce a <em>combined diff</em> when showing a merge. This is the default |
| 1883 | format when showing merges with <a href="git-diff.html">git-diff(1)</a> or |
| 1884 | <a href="git-show.html">git-show(1)</a>. Note also that you can give suitable |
| 1885 | <code>--diff-merges</code> option to any of these commands to force generation of |
| 1886 | diffs in a specific format.</p> |
| 1887 | </div> |
| 1888 | <div class="paragraph"> |
| 1889 | <p>A "combined diff" format looks like this:</p> |
| 1890 | </div> |
| 1891 | <div class="listingblock"> |
| 1892 | <div class="content"> |
| 1893 | <pre>diff --combined describe.c |
| 1894 | index fabadb8,cc95eb0..4866510 |
| 1895 | --- a/describe.c |
| 1896 | +++ b/describe.c |
| 1897 | @@@ -98,20 -98,12 +98,20 @@@ |
| 1898 | return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1; |
| 1899 | } |
| 1900 | |
| 1901 | - static void describe(char *arg) |
| 1902 | -static void describe(struct commit *cmit, int last_one) |
| 1903 | ++static void describe(char *arg, int last_one) |
| 1904 | { |
| 1905 | + unsigned char sha1[20]; |
| 1906 | + struct commit *cmit; |
| 1907 | struct commit_list *list; |
| 1908 | static int initialized = 0; |
| 1909 | struct commit_name *n; |
| 1910 | |
| 1911 | + if (get_sha1(arg, sha1) < 0) |
| 1912 | + usage(describe_usage); |
| 1913 | + cmit = lookup_commit_reference(sha1); |
| 1914 | + if (!cmit) |
| 1915 | + usage(describe_usage); |
| 1916 | + |
| 1917 | if (!initialized) { |
| 1918 | initialized = 1; |
| 1919 | for_each_ref(get_name);</pre> |
| 1920 | </div> |
| 1921 | </div> |
| 1922 | <div class="olist arabic"> |
| 1923 | <ol class="arabic"> |
| 1924 | <li> |
| 1925 | <p>It is preceded by a "git diff" header, that looks like |
| 1926 | this (when the <code>-c</code> option is used):</p> |
| 1927 | <div class="literalblock"> |
| 1928 | <div class="content"> |
| 1929 | <pre>diff --combined file</pre> |
| 1930 | </div> |
| 1931 | </div> |
| 1932 | <div class="paragraph"> |
| 1933 | <p>or like this (when the <code>--cc</code> option is used):</p> |
| 1934 | </div> |
| 1935 | <div class="literalblock"> |
| 1936 | <div class="content"> |
| 1937 | <pre>diff --cc file</pre> |
| 1938 | </div> |
| 1939 | </div> |
| 1940 | </li> |
| 1941 | <li> |
| 1942 | <p>It is followed by one or more extended header lines |
| 1943 | (this example shows a merge with two parents):</p> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1944 | <div class="verseblock"> |
Junio C Hamano | e03f599 | 2025-04-23 22:24:29 | [diff] [blame] | 1945 | <pre class="content"><code>index</code> <em><hash></em><code>,</code><em><hash></em><code>..</code><em><hash></em> |
Junio C Hamano | a644284 | 2025-06-18 21:56:06 | [diff] [blame] | 1946 | <code>mode</code> <em><mode></em><code>,</code><em><mode></em><code>..</code><em><mode></em> |
| 1947 | <code>new</code> <code>file</code> <code>mode</code> <em><mode></em> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1948 | <code>deleted</code> <code>file</code> <code>mode</code> <em><mode></em><code>,</code><em><mode></em></pre> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1949 | </div> |
| 1950 | <div class="paragraph"> |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 1951 | <p>The <code>mode</code> <em><mode></em><code>,</code><em><mode></em><code>..</code><em><mode></em> line appears only if at least one of |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1952 | the <mode> is different from the rest. Extended headers with |
| 1953 | information about detected content movement (renames and |
| 1954 | copying detection) are designed to work with the diff of two |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 1955 | <em><tree-ish></em> and are not used by combined diff format.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1956 | </div> |
| 1957 | </li> |
| 1958 | <li> |
| 1959 | <p>It is followed by a two-line from-file/to-file header:</p> |
| 1960 | <div class="literalblock"> |
| 1961 | <div class="content"> |
| 1962 | <pre>--- a/file |
| 1963 | +++ b/file</pre> |
| 1964 | </div> |
| 1965 | </div> |
| 1966 | <div class="paragraph"> |
| 1967 | <p>Similar to the two-line header for the traditional <em>unified</em> diff |
| 1968 | format, <code>/dev/null</code> is used to signal created or deleted |
| 1969 | files.</p> |
| 1970 | </div> |
| 1971 | <div class="paragraph"> |
| 1972 | <p>However, if the --combined-all-paths option is provided, instead of a |
| 1973 | two-line from-file/to-file, you get an N+1 line from-file/to-file header, |
| 1974 | where N is the number of parents in the merge commit:</p> |
| 1975 | </div> |
| 1976 | <div class="literalblock"> |
| 1977 | <div class="content"> |
| 1978 | <pre>--- a/file |
| 1979 | --- a/file |
| 1980 | --- a/file |
| 1981 | +++ b/file</pre> |
| 1982 | </div> |
| 1983 | </div> |
| 1984 | <div class="paragraph"> |
| 1985 | <p>This extended format can be useful if rename or copy detection is |
| 1986 | active, to allow you to see the original name of the file in different |
| 1987 | parents.</p> |
| 1988 | </div> |
| 1989 | </li> |
| 1990 | <li> |
| 1991 | <p>Chunk header format is modified to prevent people from |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 1992 | accidentally feeding it to <code>patch</code> <code>-p1</code>. Combined diff format |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 1993 | was created for review of merge commit changes, and was not |
| 1994 | meant to be applied. The change is similar to the change in the |
| 1995 | extended <em>index</em> header:</p> |
| 1996 | <div class="literalblock"> |
| 1997 | <div class="content"> |
| 1998 | <pre>@@@ <from-file-range> <from-file-range> <to-file-range> @@@</pre> |
| 1999 | </div> |
| 2000 | </div> |
| 2001 | <div class="paragraph"> |
| 2002 | <p>There are (number of parents + 1) <code>@</code> characters in the chunk |
| 2003 | header for combined diff format.</p> |
| 2004 | </div> |
| 2005 | </li> |
| 2006 | </ol> |
| 2007 | </div> |
| 2008 | <div class="paragraph"> |
| 2009 | <p>Unlike the traditional <em>unified</em> diff format, which shows two |
| 2010 | files A and B with a single column that has <code>-</code> (minus — appears in A but removed in B), <code>+</code> (plus — missing in A but |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 2011 | added to B), or " " (space — unchanged) prefix, this format |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2012 | compares two or more files file1, file2,…​ with one file X, and |
| 2013 | shows how X differs from each of fileN. One column for each of |
| 2014 | fileN is prepended to the output line to note how X’s line is |
| 2015 | different from it.</p> |
| 2016 | </div> |
| 2017 | <div class="paragraph"> |
| 2018 | <p>A <code>-</code> character in the column N means that the line appears in |
| 2019 | fileN but it does not appear in the result. A <code>+</code> character |
| 2020 | in the column N means that the line appears in the result, |
| 2021 | and fileN does not have that line (in other words, the line was |
| 2022 | added, from the point of view of that parent).</p> |
| 2023 | </div> |
| 2024 | <div class="paragraph"> |
| 2025 | <p>In the above example output, the function signature was changed |
| 2026 | from both files (hence two <code>-</code> removals from both file1 and |
| 2027 | file2, plus <code>++</code> to mean one line that was added does not appear |
| 2028 | in either file1 or file2). Also, eight other lines are the same |
| 2029 | from file1 but do not appear in file2 (hence prefixed with <code>+</code>).</p> |
| 2030 | </div> |
| 2031 | <div class="paragraph"> |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 2032 | <p>When shown by <code>git</code> <code>diff-tree</code> <code>-c</code>, it compares the parents of a |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2033 | merge commit with the merge result (i.e. file1..fileN are the |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 2034 | parents). When shown by <code>git</code> <code>diff-files</code> <code>-c</code>, it compares the |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2035 | two unresolved merge parents with the working tree file |
| 2036 | (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka |
| 2037 | "their version").</p> |
| 2038 | </div> |
| 2039 | </div> |
| 2040 | </div> |
| 2041 | <div class="sect1"> |
| 2042 | <h2 id="_other_diff_formats">other diff formats</h2> |
| 2043 | <div class="sectionbody"> |
| 2044 | <div class="paragraph"> |
| 2045 | <p>The <code>--summary</code> option describes newly added, deleted, renamed and |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2046 | copied files. The <code>--stat</code> option adds <code>diffstat</code>(1) graph to the |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2047 | output. These options can be combined with other options, such as |
| 2048 | <code>-p</code>, and are meant for human consumption.</p> |
| 2049 | </div> |
| 2050 | <div class="paragraph"> |
| 2051 | <p>When showing a change that involves a rename or a copy, <code>--stat</code> output |
| 2052 | formats the pathnames compactly by combining common prefix and suffix of |
| 2053 | the pathnames. For example, a change that moves <code>arch/i386/Makefile</code> to |
| 2054 | <code>arch/x86/Makefile</code> while modifying 4 lines will be shown like this:</p> |
| 2055 | </div> |
| 2056 | <div class="listingblock"> |
| 2057 | <div class="content"> |
| 2058 | <pre>arch/{i386 => x86}/Makefile | 4 +--</pre> |
| 2059 | </div> |
| 2060 | </div> |
| 2061 | <div class="paragraph"> |
| 2062 | <p>The <code>--numstat</code> option gives the diffstat(1) information but is designed |
| 2063 | for easier machine consumption. An entry in <code>--numstat</code> output looks |
| 2064 | like this:</p> |
| 2065 | </div> |
| 2066 | <div class="listingblock"> |
| 2067 | <div class="content"> |
| 2068 | <pre>1 2 README |
| 2069 | 3 1 arch/{i386 => x86}/Makefile</pre> |
| 2070 | </div> |
| 2071 | </div> |
| 2072 | <div class="paragraph"> |
| 2073 | <p>That is, from left to right:</p> |
| 2074 | </div> |
| 2075 | <div class="olist arabic"> |
| 2076 | <ol class="arabic"> |
| 2077 | <li> |
| 2078 | <p>the number of added lines;</p> |
| 2079 | </li> |
| 2080 | <li> |
| 2081 | <p>a tab;</p> |
| 2082 | </li> |
| 2083 | <li> |
| 2084 | <p>the number of deleted lines;</p> |
| 2085 | </li> |
| 2086 | <li> |
| 2087 | <p>a tab;</p> |
| 2088 | </li> |
| 2089 | <li> |
| 2090 | <p>pathname (possibly with rename/copy information);</p> |
| 2091 | </li> |
| 2092 | <li> |
| 2093 | <p>a newline.</p> |
| 2094 | </li> |
| 2095 | </ol> |
| 2096 | </div> |
| 2097 | <div class="paragraph"> |
| 2098 | <p>When <code>-z</code> output option is in effect, the output is formatted this way:</p> |
| 2099 | </div> |
| 2100 | <div class="listingblock"> |
| 2101 | <div class="content"> |
| 2102 | <pre>1 2 README NUL |
| 2103 | 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</pre> |
| 2104 | </div> |
| 2105 | </div> |
| 2106 | <div class="paragraph"> |
| 2107 | <p>That is:</p> |
| 2108 | </div> |
| 2109 | <div class="olist arabic"> |
| 2110 | <ol class="arabic"> |
| 2111 | <li> |
| 2112 | <p>the number of added lines;</p> |
| 2113 | </li> |
| 2114 | <li> |
| 2115 | <p>a tab;</p> |
| 2116 | </li> |
| 2117 | <li> |
| 2118 | <p>the number of deleted lines;</p> |
| 2119 | </li> |
| 2120 | <li> |
| 2121 | <p>a tab;</p> |
| 2122 | </li> |
| 2123 | <li> |
| 2124 | <p>a NUL (only exists if renamed/copied);</p> |
| 2125 | </li> |
| 2126 | <li> |
| 2127 | <p>pathname in preimage;</p> |
| 2128 | </li> |
| 2129 | <li> |
| 2130 | <p>a NUL (only exists if renamed/copied);</p> |
| 2131 | </li> |
| 2132 | <li> |
| 2133 | <p>pathname in postimage (only exists if renamed/copied);</p> |
| 2134 | </li> |
| 2135 | <li> |
| 2136 | <p>a NUL.</p> |
| 2137 | </li> |
| 2138 | </ol> |
| 2139 | </div> |
| 2140 | <div class="paragraph"> |
| 2141 | <p>The extra <code>NUL</code> before the preimage path in renamed case is to allow |
| 2142 | scripts that read the output to tell if the current record being read is |
| 2143 | a single-path record or a rename/copy record without reading ahead. |
| 2144 | After reading added and deleted lines, reading up to <code>NUL</code> would yield |
| 2145 | the pathname, but if that is <code>NUL</code>, the record will show two paths.</p> |
| 2146 | </div> |
| 2147 | </div> |
| 2148 | </div> |
| 2149 | <div class="sect1"> |
| 2150 | <h2 id="_examples">EXAMPLES</h2> |
| 2151 | <div class="sectionbody"> |
| 2152 | <div class="dlist"> |
| 2153 | <dl> |
| 2154 | <dt class="hdlist1">Various ways to check your working tree</dt> |
| 2155 | <dd> |
| 2156 | <div class="listingblock"> |
| 2157 | <div class="content"> |
| 2158 | <pre>$ git diff <b class="conum">(1)</b> |
| 2159 | $ git diff --cached <b class="conum">(2)</b> |
| 2160 | $ git diff HEAD <b class="conum">(3)</b> |
| 2161 | $ git diff AUTO_MERGE <b class="conum">(4)</b></pre> |
| 2162 | </div> |
| 2163 | </div> |
| 2164 | <div class="colist arabic"> |
| 2165 | <ol> |
| 2166 | <li> |
| 2167 | <p>Changes in the working tree not yet staged for the next commit.</p> |
| 2168 | </li> |
| 2169 | <li> |
| 2170 | <p>Changes between the index and your last commit; what you |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 2171 | would be committing if you run <code>git</code> <code>commit</code> without <code>-a</code> option.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2172 | </li> |
| 2173 | <li> |
| 2174 | <p>Changes in the working tree since your last commit; what you |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 2175 | would be committing if you run <code>git</code> <code>commit</code> <code>-a</code></p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2176 | </li> |
| 2177 | <li> |
| 2178 | <p>Changes in the working tree you’ve made to resolve textual |
| 2179 | conflicts so far.</p> |
| 2180 | </li> |
| 2181 | </ol> |
| 2182 | </div> |
| 2183 | </dd> |
| 2184 | <dt class="hdlist1">Comparing with arbitrary commits</dt> |
| 2185 | <dd> |
| 2186 | <div class="listingblock"> |
| 2187 | <div class="content"> |
| 2188 | <pre>$ git diff test <b class="conum">(1)</b> |
| 2189 | $ git diff HEAD -- ./test <b class="conum">(2)</b> |
| 2190 | $ git diff HEAD^ HEAD <b class="conum">(3)</b></pre> |
| 2191 | </div> |
| 2192 | </div> |
| 2193 | <div class="colist arabic"> |
| 2194 | <ol> |
| 2195 | <li> |
| 2196 | <p>Instead of using the tip of the current branch, compare with the |
| 2197 | tip of "test" branch.</p> |
| 2198 | </li> |
| 2199 | <li> |
| 2200 | <p>Instead of comparing with the tip of "test" branch, compare with |
| 2201 | the tip of the current branch, but limit the comparison to the |
| 2202 | file "test".</p> |
| 2203 | </li> |
| 2204 | <li> |
| 2205 | <p>Compare the version before the last commit and the last commit.</p> |
| 2206 | </li> |
| 2207 | </ol> |
| 2208 | </div> |
| 2209 | </dd> |
| 2210 | <dt class="hdlist1">Comparing branches</dt> |
| 2211 | <dd> |
| 2212 | <div class="listingblock"> |
| 2213 | <div class="content"> |
| 2214 | <pre>$ git diff topic master <b class="conum">(1)</b> |
| 2215 | $ git diff topic..master <b class="conum">(2)</b> |
| 2216 | $ git diff topic...master <b class="conum">(3)</b></pre> |
| 2217 | </div> |
| 2218 | </div> |
| 2219 | <div class="colist arabic"> |
| 2220 | <ol> |
| 2221 | <li> |
| 2222 | <p>Changes between the tips of the topic and the master branches.</p> |
| 2223 | </li> |
| 2224 | <li> |
| 2225 | <p>Same as above.</p> |
| 2226 | </li> |
| 2227 | <li> |
| 2228 | <p>Changes that occurred on the master branch since when the topic |
| 2229 | branch was started off it.</p> |
| 2230 | </li> |
| 2231 | </ol> |
| 2232 | </div> |
| 2233 | </dd> |
| 2234 | <dt class="hdlist1">Limiting the diff output</dt> |
| 2235 | <dd> |
| 2236 | <div class="listingblock"> |
| 2237 | <div class="content"> |
| 2238 | <pre>$ git diff --diff-filter=MRC <b class="conum">(1)</b> |
| 2239 | $ git diff --name-status <b class="conum">(2)</b> |
| 2240 | $ git diff arch/i386 include/asm-i386 <b class="conum">(3)</b></pre> |
| 2241 | </div> |
| 2242 | </div> |
| 2243 | <div class="colist arabic"> |
| 2244 | <ol> |
| 2245 | <li> |
| 2246 | <p>Show only modification, rename, and copy, but not addition |
| 2247 | or deletion.</p> |
| 2248 | </li> |
| 2249 | <li> |
| 2250 | <p>Show only names and the nature of change, but not actual |
| 2251 | diff output.</p> |
| 2252 | </li> |
| 2253 | <li> |
| 2254 | <p>Limit diff output to named subtrees.</p> |
| 2255 | </li> |
| 2256 | </ol> |
| 2257 | </div> |
| 2258 | </dd> |
| 2259 | <dt class="hdlist1">Munging the diff output</dt> |
| 2260 | <dd> |
| 2261 | <div class="listingblock"> |
| 2262 | <div class="content"> |
| 2263 | <pre>$ git diff --find-copies-harder -B -C <b class="conum">(1)</b> |
| 2264 | $ git diff -R <b class="conum">(2)</b></pre> |
| 2265 | </div> |
| 2266 | </div> |
| 2267 | <div class="colist arabic"> |
| 2268 | <ol> |
| 2269 | <li> |
| 2270 | <p>Spend extra cycles to find renames, copies and complete |
| 2271 | rewrites (very expensive).</p> |
| 2272 | </li> |
| 2273 | <li> |
| 2274 | <p>Output diff in reverse.</p> |
| 2275 | </li> |
| 2276 | </ol> |
| 2277 | </div> |
| 2278 | </dd> |
| 2279 | </dl> |
| 2280 | </div> |
| 2281 | </div> |
| 2282 | </div> |
| 2283 | <div class="sect1"> |
| 2284 | <h2 id="_configuration">CONFIGURATION</h2> |
| 2285 | <div class="sectionbody"> |
| 2286 | <div class="paragraph"> |
| 2287 | <p>Everything below this line in this section is selectively included |
| 2288 | from the <a href="git-config.html">git-config(1)</a> documentation. The content is the same |
| 2289 | as what’s found there:</p> |
| 2290 | </div> |
| 2291 | <div class="dlist"> |
| 2292 | <dl> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2293 | <dt class="hdlist1"><code>diff.autoRefreshIndex</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2294 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2295 | <p>When using <code>git</code> <code>diff</code> to compare with work tree |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2296 | files, do not consider stat-only changes as changed. |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 2297 | Instead, silently run <code>git</code> <code>update-index</code> <code>--refresh</code> to |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2298 | update the cached stat information for paths whose |
| 2299 | contents in the work tree match the contents in the |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2300 | index. This option defaults to <code>true</code>. Note that this |
| 2301 | affects only <code>git</code> <code>diff</code> Porcelain, and not lower level |
| 2302 | <code>diff</code> commands such as <code>git</code> <code>diff-files</code>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2303 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2304 | <dt class="hdlist1"><code>diff.dirstat</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2305 | <dd> |
| 2306 | <p>A comma separated list of <code>--dirstat</code> parameters specifying the |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2307 | default behavior of the <code>--dirstat</code> option to <code>git</code> <code>diff</code> and friends. |
| 2308 | The defaults can be overridden on the command line |
| 2309 | (using <code>--dirstat=</code><em><param></em><code>,..</code>.). The fallback defaults |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2310 | (when not changed by <code>diff.dirstat</code>) are <code>changes,noncumulative,3</code>. |
| 2311 | The following parameters are available:</p> |
| 2312 | <div class="openblock"> |
| 2313 | <div class="content"> |
| 2314 | <div class="dlist"> |
| 2315 | <dl> |
| 2316 | <dt class="hdlist1"><code>changes</code></dt> |
| 2317 | <dd> |
| 2318 | <p>Compute the dirstat numbers by counting the lines that have been |
| 2319 | removed from the source, or added to the destination. This ignores |
| 2320 | the amount of pure code movements within a file. In other words, |
| 2321 | rearranging lines in a file is not counted as much as other changes. |
| 2322 | This is the default behavior when no parameter is given.</p> |
| 2323 | </dd> |
| 2324 | <dt class="hdlist1"><code>lines</code></dt> |
| 2325 | <dd> |
| 2326 | <p>Compute the dirstat numbers by doing the regular line-based diff |
| 2327 | analysis, and summing the removed/added line counts. (For binary |
| 2328 | files, count 64-byte chunks instead, since binary files have no |
| 2329 | natural concept of lines). This is a more expensive <code>--dirstat</code> |
| 2330 | behavior than the <code>changes</code> behavior, but it does count rearranged |
| 2331 | lines within a file as much as other changes. The resulting output |
Junio C Hamano | e03f599 | 2025-04-23 22:24:29 | [diff] [blame] | 2332 | is consistent with what you get from the other <code>--*stat</code> options.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2333 | </dd> |
| 2334 | <dt class="hdlist1"><code>files</code></dt> |
| 2335 | <dd> |
| 2336 | <p>Compute the dirstat numbers by counting the number of files changed. |
| 2337 | Each changed file counts equally in the dirstat analysis. This is |
| 2338 | the computationally cheapest <code>--dirstat</code> behavior, since it does |
| 2339 | not have to look at the file contents at all.</p> |
| 2340 | </dd> |
| 2341 | <dt class="hdlist1"><code>cumulative</code></dt> |
| 2342 | <dd> |
| 2343 | <p>Count changes in a child directory for the parent directory as well. |
| 2344 | Note that when using <code>cumulative</code>, the sum of the percentages |
| 2345 | reported may exceed 100%. The default (non-cumulative) behavior can |
| 2346 | be specified with the <code>noncumulative</code> parameter.</p> |
| 2347 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2348 | <dt class="hdlist1"><em><limit></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2349 | <dd> |
| 2350 | <p>An integer parameter specifies a cut-off percent (3% by default). |
| 2351 | Directories contributing less than this percentage of the changes |
| 2352 | are not shown in the output.</p> |
| 2353 | </dd> |
| 2354 | </dl> |
| 2355 | </div> |
| 2356 | </div> |
| 2357 | </div> |
| 2358 | <div class="paragraph"> |
| 2359 | <p>Example: The following will count changed files, while ignoring |
| 2360 | directories with less than 10% of the total amount of changed files, |
| 2361 | and accumulating child directory counts in the parent directories: |
| 2362 | <code>files,10,cumulative</code>.</p> |
| 2363 | </div> |
| 2364 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2365 | <dt class="hdlist1"><code>diff.statNameWidth</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2366 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2367 | <p>Limit the width of the filename part in <code>--stat</code> output. If set, applies |
| 2368 | to all commands generating <code>--stat</code> output except <code>format-patch</code>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2369 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2370 | <dt class="hdlist1"><code>diff.statGraphWidth</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2371 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2372 | <p>Limit the width of the graph part in <code>--stat</code> output. If set, applies |
| 2373 | to all commands generating <code>--stat</code> output except <code>format-patch</code>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2374 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2375 | <dt class="hdlist1"><code>diff.context</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2376 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2377 | <p>Generate diffs with <em><n></em> lines of context instead of the default |
| 2378 | of 3. This value is overridden by the <code>-U</code> option.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2379 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2380 | <dt class="hdlist1"><code>diff.interHunkContext</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2381 | <dd> |
| 2382 | <p>Show the context between diff hunks, up to the specified number |
| 2383 | of lines, thereby fusing the hunks that are close to each other. |
| 2384 | This value serves as the default for the <code>--inter-hunk-context</code> |
| 2385 | command line option.</p> |
| 2386 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2387 | <dt class="hdlist1"><code>diff.external</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2388 | <dd> |
| 2389 | <p>If this config variable is set, diff generation is not |
| 2390 | performed using the internal diff machinery, but using the |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2391 | given command. Can be overridden with the <code>GIT_EXTERNAL_DIFF</code> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2392 | environment variable. The command is called with parameters |
| 2393 | as described under "git Diffs" in <a href="git.html">git(1)</a>. Note: if |
| 2394 | you want to use an external diff program only on a subset of |
| 2395 | your files, you might want to use <a href="gitattributes.html">gitattributes(5)</a> instead.</p> |
| 2396 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2397 | <dt class="hdlist1"><code>diff.trustExitCode</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2398 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2399 | <p>If this boolean value is set to <code>true</code> then the |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2400 | <code>diff.external</code> command is expected to return exit code |
| 2401 | 0 if it considers the input files to be equal or 1 if it |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2402 | considers them to be different, like <code>diff</code>(1). |
| 2403 | If it is set to <code>false</code>, which is the default, then the command |
| 2404 | is expected to return exit code <code>0</code> regardless of equality. |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2405 | Any other exit code causes Git to report a fatal error.</p> |
| 2406 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2407 | <dt class="hdlist1"><code>diff.ignoreSubmodules</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2408 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2409 | <p>Sets the default value of <code>--ignore-submodules</code>. Note that this |
| 2410 | affects only <code>git</code> <code>diff</code> Porcelain, and not lower level <code>diff</code> |
| 2411 | commands such as <code>git</code> <code>diff-files</code>. <code>git</code> <code>checkout</code> |
| 2412 | and <code>git</code> <code>switch</code> also honor |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2413 | this setting when reporting uncommitted changes. Setting it to |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2414 | <code>all</code> disables the submodule summary normally shown by <code>git</code> <code>commit</code> |
| 2415 | and <code>git</code> <code>status</code> when <code>status.submoduleSummary</code> is set unless it is |
| 2416 | overridden by using the <code>--ignore-submodules</code> command-line option. |
| 2417 | The <code>git</code> <code>submodule</code> commands are not affected by this setting. |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2418 | By default this is set to untracked so that any untracked |
| 2419 | submodules are ignored.</p> |
| 2420 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2421 | <dt class="hdlist1"><code>diff.mnemonicPrefix</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2422 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2423 | <p>If set, <code>git</code> <code>diff</code> uses a prefix pair that is different from the |
| 2424 | standard <code>a/</code> and <code>b/</code> depending on what is being compared. When |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2425 | this configuration is in effect, reverse diff output also swaps |
| 2426 | the order of the prefixes:</p> |
| 2427 | <div class="dlist"> |
| 2428 | <dl> |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 2429 | <dt class="hdlist1"><code>git</code> <code>diff</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2430 | <dd> |
| 2431 | <p>compares the (i)ndex and the (w)ork tree;</p> |
| 2432 | </dd> |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 2433 | <dt class="hdlist1"><code>git</code> <code>diff</code> <code>HEAD</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2434 | <dd> |
| 2435 | <p>compares a (c)ommit and the (w)ork tree;</p> |
| 2436 | </dd> |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 2437 | <dt class="hdlist1"><code>git</code> <code>diff</code> <code>--cached</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2438 | <dd> |
| 2439 | <p>compares a (c)ommit and the (i)ndex;</p> |
| 2440 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2441 | <dt class="hdlist1"><code>git</code> <code>diff</code> <code>HEAD:</code><em><file1></em> <em><file2></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2442 | <dd> |
| 2443 | <p>compares an (o)bject and a (w)ork tree entity;</p> |
| 2444 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2445 | <dt class="hdlist1"><code>git</code> <code>diff</code> <code>--no-index</code> <em><a></em> <em><b></em></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2446 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2447 | <p>compares two non-git things <em><a></em> and <em><b></em>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2448 | </dd> |
| 2449 | </dl> |
| 2450 | </div> |
| 2451 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2452 | <dt class="hdlist1"><code>diff.noPrefix</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2453 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2454 | <p>If set, <code>git</code> <code>diff</code> does not show any source or destination prefix.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2455 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2456 | <dt class="hdlist1"><code>diff.srcPrefix</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2457 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2458 | <p>If set, <code>git</code> <code>diff</code> uses this source prefix. Defaults to <code>a/</code>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2459 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2460 | <dt class="hdlist1"><code>diff.dstPrefix</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2461 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2462 | <p>If set, <code>git</code> <code>diff</code> uses this destination prefix. Defaults to <code>b/</code>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2463 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2464 | <dt class="hdlist1"><code>diff.relative</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2465 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2466 | <p>If set to <code>true</code>, <code>git</code> <code>diff</code> does not show changes outside of the directory |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2467 | and show pathnames relative to the current directory.</p> |
| 2468 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2469 | <dt class="hdlist1"><code>diff.orderFile</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2470 | <dd> |
| 2471 | <p>File indicating how to order files within a diff. |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2472 | See the <code>-O</code> option for details. |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2473 | If <code>diff.orderFile</code> is a relative pathname, it is treated as |
| 2474 | relative to the top of the working tree.</p> |
| 2475 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2476 | <dt class="hdlist1"><code>diff.renameLimit</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2477 | <dd> |
| 2478 | <p>The number of files to consider in the exhaustive portion of |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2479 | copy/rename detection; equivalent to the <code>git</code> <code>diff</code> option |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2480 | <code>-l</code>. If not set, the default value is currently 1000. This |
| 2481 | setting has no effect if rename detection is turned off.</p> |
| 2482 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2483 | <dt class="hdlist1"><code>diff.renames</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2484 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2485 | <p>Whether and how Git detects renames. If set to <code>false</code>, |
| 2486 | rename detection is disabled. If set to <code>true</code>, basic rename |
| 2487 | detection is enabled. If set to <code>copies</code> or <code>copy</code>, Git will |
| 2488 | detect copies, as well. Defaults to <code>true</code>. Note that this |
| 2489 | affects only <code>git</code> <code>diff</code> Porcelain like <a href="git-diff.html">git-diff(1)</a> and |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2490 | <a href="git-log.html">git-log(1)</a>, and not lower level commands such as |
| 2491 | <a href="git-diff-files.html">git-diff-files(1)</a>.</p> |
| 2492 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2493 | <dt class="hdlist1"><code>diff.suppressBlankEmpty</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2494 | <dd> |
| 2495 | <p>A boolean to inhibit the standard behavior of printing a space |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2496 | before each empty output line. Defaults to <code>false</code>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2497 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2498 | <dt class="hdlist1"><code>diff.submodule</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2499 | <dd> |
| 2500 | <p>Specify the format in which differences in submodules are |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2501 | shown. The <code>short</code> format just shows the names of the commits |
| 2502 | at the beginning and end of the range. The <code>log</code> format lists |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2503 | the commits in the range like <a href="git-submodule.html">git-submodule(1)</a> <code>summary</code> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2504 | does. The <code>diff</code> format shows an inline diff of the changed |
| 2505 | contents of the submodule. Defaults to <code>short</code>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2506 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2507 | <dt class="hdlist1"><code>diff.wordRegex</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2508 | <dd> |
| 2509 | <p>A POSIX Extended Regular Expression used to determine what is a "word" |
| 2510 | when performing word-by-word difference calculations. Character |
| 2511 | sequences that match the regular expression are "words", all other |
| 2512 | characters are <strong>ignorable</strong> whitespace.</p> |
| 2513 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2514 | <dt class="hdlist1"><code>diff.</code><em><driver></em><code>.command</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2515 | <dd> |
| 2516 | <p>The custom diff driver command. See <a href="gitattributes.html">gitattributes(5)</a> |
| 2517 | for details.</p> |
| 2518 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2519 | <dt class="hdlist1"><code>diff.</code><em><driver></em><code>.trustExitCode</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2520 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2521 | <p>If this boolean value is set to <code>true</code> then the |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 2522 | <code>diff.</code><em><driver></em><code>.command</code> command is expected to return exit code |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2523 | 0 if it considers the input files to be equal or 1 if it |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2524 | considers them to be different, like <code>diff</code>(1). |
| 2525 | If it is set to <code>false</code>, which is the default, then the command |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2526 | is expected to return exit code 0 regardless of equality. |
| 2527 | Any other exit code causes Git to report a fatal error.</p> |
| 2528 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2529 | <dt class="hdlist1"><code>diff.</code><em><driver></em><code>.xfuncname</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2530 | <dd> |
| 2531 | <p>The regular expression that the diff driver should use to |
| 2532 | recognize the hunk header. A built-in pattern may also be used. |
| 2533 | See <a href="gitattributes.html">gitattributes(5)</a> for details.</p> |
| 2534 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2535 | <dt class="hdlist1"><code>diff.</code><em><driver></em><code>.binary</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2536 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2537 | <p>Set this option to <code>true</code> to make the diff driver treat files as |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2538 | binary. See <a href="gitattributes.html">gitattributes(5)</a> for details.</p> |
| 2539 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2540 | <dt class="hdlist1"><code>diff.</code><em><driver></em><code>.textconv</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2541 | <dd> |
| 2542 | <p>The command that the diff driver should call to generate the |
| 2543 | text-converted version of a file. The result of the |
| 2544 | conversion is used to generate a human-readable diff. See |
| 2545 | <a href="gitattributes.html">gitattributes(5)</a> for details.</p> |
| 2546 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2547 | <dt class="hdlist1"><code>diff.</code><em><driver></em><code>.wordRegex</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2548 | <dd> |
| 2549 | <p>The regular expression that the diff driver should use to |
| 2550 | split words in a line. See <a href="gitattributes.html">gitattributes(5)</a> for |
| 2551 | details.</p> |
| 2552 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2553 | <dt class="hdlist1"><code>diff.</code><em><driver></em><code>.cachetextconv</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2554 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2555 | <p>Set this option to <code>true</code> to make the diff driver cache the text |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2556 | conversion outputs. See <a href="gitattributes.html">gitattributes(5)</a> for details.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2557 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2558 | <dt class="hdlist1"><code>diff.indentHeuristic</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2559 | <dd> |
| 2560 | <p>Set this option to <code>false</code> to disable the default heuristics |
| 2561 | that shift diff hunk boundaries to make patches easier to read.</p> |
| 2562 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2563 | <dt class="hdlist1"><code>diff.algorithm</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2564 | <dd> |
| 2565 | <p>Choose a diff algorithm. The variants are as follows:</p> |
| 2566 | <div class="openblock"> |
| 2567 | <div class="content"> |
| 2568 | <div class="dlist"> |
| 2569 | <dl> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2570 | <dt class="hdlist1"><code>default</code></dt> |
| 2571 | <dt class="hdlist1"><code>myers</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2572 | <dd> |
| 2573 | <p>The basic greedy diff algorithm. Currently, this is the default.</p> |
| 2574 | </dd> |
| 2575 | <dt class="hdlist1"><code>minimal</code></dt> |
| 2576 | <dd> |
| 2577 | <p>Spend extra time to make sure the smallest possible diff is |
| 2578 | produced.</p> |
| 2579 | </dd> |
| 2580 | <dt class="hdlist1"><code>patience</code></dt> |
| 2581 | <dd> |
| 2582 | <p>Use "patience diff" algorithm when generating patches.</p> |
| 2583 | </dd> |
| 2584 | <dt class="hdlist1"><code>histogram</code></dt> |
| 2585 | <dd> |
| 2586 | <p>This algorithm extends the patience algorithm to "support |
| 2587 | low-occurrence common elements".</p> |
| 2588 | </dd> |
| 2589 | </dl> |
| 2590 | </div> |
| 2591 | </div> |
| 2592 | </div> |
| 2593 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2594 | <dt class="hdlist1"><code>diff.wsErrorHighlight</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2595 | <dd> |
| 2596 | <p>Highlight whitespace errors in the <code>context</code>, <code>old</code> or <code>new</code> |
| 2597 | lines of the diff. Multiple values are separated by comma, |
| 2598 | <code>none</code> resets previous values, <code>default</code> reset the list to |
| 2599 | <code>new</code> and <code>all</code> is a shorthand for <code>old,new,context</code>. The |
| 2600 | whitespace errors are colored with <code>color.diff.whitespace</code>. |
Junio C Hamano | dc39238 | 2024-10-11 18:57:29 | [diff] [blame] | 2601 | The command line option <code>--ws-error-highlight=</code><em><kind></em> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2602 | overrides this setting.</p> |
| 2603 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2604 | <dt class="hdlist1"><code>diff.colorMoved</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2605 | <dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2606 | <p>If set to either a valid <em><mode></em> or a <code>true</code> value, moved lines |
| 2607 | in a diff are colored differently. |
| 2608 | For details of valid modes see <code>--color-moved</code>. |
| 2609 | If simply set to <code>true</code> the default color mode will be used. When |
| 2610 | set to <code>false</code>, moved lines are not colored.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2611 | </dd> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2612 | <dt class="hdlist1"><code>diff.colorMovedWS</code></dt> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2613 | <dd> |
| 2614 | <p>When moved lines are colored using e.g. the <code>diff.colorMoved</code> setting, |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2615 | this option controls the mode how spaces are treated. |
| 2616 | For details of valid modes see <code>--color-moved-ws</code> in <a href="git-diff.html">git-diff(1)</a>.</p> |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2617 | </dd> |
| 2618 | </dl> |
| 2619 | </div> |
| 2620 | </div> |
| 2621 | </div> |
| 2622 | <div class="sect1"> |
| 2623 | <h2 id="_see_also">SEE ALSO</h2> |
| 2624 | <div class="sectionbody"> |
| 2625 | <div class="paragraph"> |
Junio C Hamano | 7f7e6a4 | 2024-12-04 04:45:58 | [diff] [blame] | 2626 | <p><code>diff</code>(1), |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2627 | <a href="git-difftool.html">git-difftool(1)</a>, |
| 2628 | <a href="git-log.html">git-log(1)</a>, |
| 2629 | <a href="gitdiffcore.html">gitdiffcore(7)</a>, |
| 2630 | <a href="git-format-patch.html">git-format-patch(1)</a>, |
| 2631 | <a href="git-apply.html">git-apply(1)</a>, |
| 2632 | <a href="git-show.html">git-show(1)</a></p> |
| 2633 | </div> |
| 2634 | </div> |
| 2635 | </div> |
| 2636 | <div class="sect1"> |
| 2637 | <h2 id="_git">GIT</h2> |
| 2638 | <div class="sectionbody"> |
| 2639 | <div class="paragraph"> |
| 2640 | <p>Part of the <a href="git.html">git(1)</a> suite</p> |
| 2641 | </div> |
| 2642 | </div> |
| 2643 | </div> |
| 2644 | </div> |
| 2645 | <div id="footer"> |
| 2646 | <div id="footer-text"> |
Junio C Hamano | a83f912 | 2025-07-21 21:51:14 | [diff] [blame] | 2647 | Last updated 2025-06-24 11:24:02 -0700 |
Junio C Hamano | b96f40a | 2024-08-01 00:57:25 | [diff] [blame] | 2648 | </div> |
| 2649 | </div> |
| 2650 | </body> |
| 2651 | </html> |