Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
| 2 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
| 4 | <head> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 5 | <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 8.6.9" /> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 7 | <title>git-diff-index(1)</title> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 8 | <style type="text/css"> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 9 | /* Shared CSS for AsciiDoc xhtml11 and html5 backends */ |
| 10 | |
| 11 | /* Default font. */ |
| 12 | body { |
| 13 | font-family: Georgia,serif; |
| 14 | } |
| 15 | |
| 16 | /* Title font. */ |
| 17 | h1, h2, h3, h4, h5, h6, |
| 18 | div.title, caption.title, |
| 19 | thead, p.table.header, |
| 20 | #toctitle, |
| 21 | #author, #revnumber, #revdate, #revremark, |
| 22 | #footer { |
| 23 | font-family: Arial,Helvetica,sans-serif; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | body { |
| 27 | margin: 1em 5% 1em 5%; |
| 28 | } |
| 29 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 30 | a { |
| 31 | color: blue; |
| 32 | text-decoration: underline; |
| 33 | } |
| 34 | a:visited { |
| 35 | color: fuchsia; |
| 36 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 37 | |
| 38 | em { |
| 39 | font-style: italic; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 40 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | strong { |
| 44 | font-weight: bold; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 45 | color: #083194; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 46 | } |
| 47 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 48 | h1, h2, h3, h4, h5, h6 { |
| 49 | color: #527bbd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 50 | margin-top: 1.2em; |
| 51 | margin-bottom: 0.5em; |
| 52 | line-height: 1.3; |
| 53 | } |
| 54 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 55 | h1, h2, h3 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 56 | border-bottom: 2px solid silver; |
| 57 | } |
| 58 | h2 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 59 | padding-top: 0.5em; |
| 60 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 61 | h3 { |
| 62 | float: left; |
| 63 | } |
| 64 | h3 + * { |
| 65 | clear: left; |
| 66 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 67 | h5 { |
| 68 | font-size: 1.0em; |
| 69 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 70 | |
| 71 | div.sectionbody { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 72 | margin-left: 0; |
| 73 | } |
| 74 | |
| 75 | hr { |
| 76 | border: 1px solid silver; |
| 77 | } |
| 78 | |
| 79 | p { |
| 80 | margin-top: 0.5em; |
| 81 | margin-bottom: 0.5em; |
| 82 | } |
| 83 | |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 84 | ul, ol, li > p { |
| 85 | margin-top: 0; |
| 86 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 87 | ul > li { color: #aaa; } |
| 88 | ul > li > * { color: black; } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 89 | |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 90 | .monospaced, code, pre { |
| 91 | font-family: "Courier New", Courier, monospace; |
| 92 | font-size: inherit; |
| 93 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 94 | padding: 0; |
| 95 | margin: 0; |
| 96 | } |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 97 | pre { |
| 98 | white-space: pre-wrap; |
| 99 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 100 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 101 | #author { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 102 | color: #527bbd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 103 | font-weight: bold; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 104 | font-size: 1.1em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 105 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 106 | #email { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 107 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 108 | #revnumber, #revdate, #revremark { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 109 | } |
| 110 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 111 | #footer { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 112 | font-size: small; |
| 113 | border-top: 2px solid silver; |
| 114 | padding-top: 0.5em; |
| 115 | margin-top: 4.0em; |
| 116 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 117 | #footer-text { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 118 | float: left; |
| 119 | padding-bottom: 0.5em; |
| 120 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 121 | #footer-badges { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 122 | float: right; |
| 123 | padding-bottom: 0.5em; |
| 124 | } |
| 125 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 126 | #preamble { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 127 | margin-top: 1.5em; |
| 128 | margin-bottom: 1.5em; |
| 129 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 130 | div.imageblock, div.exampleblock, div.verseblock, |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 131 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 132 | div.admonitionblock { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 133 | margin-top: 1.0em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 134 | margin-bottom: 1.5em; |
| 135 | } |
| 136 | div.admonitionblock { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 137 | margin-top: 2.0em; |
| 138 | margin-bottom: 2.0em; |
| 139 | margin-right: 10%; |
| 140 | color: #606060; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | div.content { /* Block element content. */ |
| 144 | padding: 0; |
| 145 | } |
| 146 | |
| 147 | /* Block element titles. */ |
| 148 | div.title, caption.title { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 149 | color: #527bbd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 150 | font-weight: bold; |
| 151 | text-align: left; |
| 152 | margin-top: 1.0em; |
| 153 | margin-bottom: 0.5em; |
| 154 | } |
| 155 | div.title + * { |
| 156 | margin-top: 0; |
| 157 | } |
| 158 | |
| 159 | td div.title:first-child { |
| 160 | margin-top: 0.0em; |
| 161 | } |
| 162 | div.content div.title:first-child { |
| 163 | margin-top: 0.0em; |
| 164 | } |
| 165 | div.content + div.title { |
| 166 | margin-top: 0.0em; |
| 167 | } |
| 168 | |
| 169 | div.sidebarblock > div.content { |
| 170 | background: #ffffee; |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 171 | border: 1px solid #dddddd; |
| 172 | border-left: 4px solid #f0f0f0; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 173 | padding: 0.5em; |
| 174 | } |
| 175 | |
| 176 | div.listingblock > div.content { |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 177 | border: 1px solid #dddddd; |
| 178 | border-left: 5px solid #f0f0f0; |
| 179 | background: #f8f8f8; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 180 | padding: 0.5em; |
| 181 | } |
| 182 | |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 183 | div.quoteblock, div.verseblock { |
| 184 | padding-left: 1.0em; |
| 185 | margin-left: 1.0em; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 186 | margin-right: 10%; |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 187 | border-left: 5px solid #f0f0f0; |
| 188 | color: #888; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 189 | } |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 190 | |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 191 | div.quoteblock > div.attribution { |
| 192 | padding-top: 0.5em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 193 | text-align: right; |
| 194 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 195 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 196 | div.verseblock > pre.content { |
| 197 | font-family: inherit; |
| 198 | font-size: inherit; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 199 | } |
| 200 | div.verseblock > div.attribution { |
| 201 | padding-top: 0.75em; |
| 202 | text-align: left; |
| 203 | } |
| 204 | /* DEPRECATED: Pre version 8.2.7 verse style literal block. */ |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 205 | div.verseblock + div.attribution { |
| 206 | text-align: left; |
| 207 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 208 | |
| 209 | div.admonitionblock .icon { |
| 210 | vertical-align: top; |
| 211 | font-size: 1.1em; |
| 212 | font-weight: bold; |
| 213 | text-decoration: underline; |
| 214 | color: #527bbd; |
| 215 | padding-right: 0.5em; |
| 216 | } |
| 217 | div.admonitionblock td.content { |
| 218 | padding-left: 0.5em; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 219 | border-left: 3px solid #dddddd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | div.exampleblock > div.content { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 223 | border-left: 3px solid #dddddd; |
| 224 | padding-left: 0.5em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 225 | } |
| 226 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 227 | div.imageblock div.content { padding-left: 0; } |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 228 | span.image img { border-style: none; vertical-align: text-bottom; } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 229 | a.image:visited { color: white; } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 230 | |
| 231 | dl { |
| 232 | margin-top: 0.8em; |
| 233 | margin-bottom: 0.8em; |
| 234 | } |
| 235 | dt { |
| 236 | margin-top: 0.5em; |
| 237 | margin-bottom: 0; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 238 | font-style: normal; |
| 239 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 240 | } |
| 241 | dd > *:first-child { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 242 | margin-top: 0.1em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | ul, ol { |
| 246 | list-style-position: outside; |
| 247 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 248 | ol.arabic { |
| 249 | list-style-type: decimal; |
| 250 | } |
| 251 | ol.loweralpha { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 252 | list-style-type: lower-alpha; |
| 253 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 254 | ol.upperalpha { |
| 255 | list-style-type: upper-alpha; |
| 256 | } |
| 257 | ol.lowerroman { |
| 258 | list-style-type: lower-roman; |
| 259 | } |
| 260 | ol.upperroman { |
| 261 | list-style-type: upper-roman; |
| 262 | } |
| 263 | |
| 264 | div.compact ul, div.compact ol, |
| 265 | div.compact p, div.compact p, |
| 266 | div.compact div, div.compact div { |
| 267 | margin-top: 0.1em; |
| 268 | margin-bottom: 0.1em; |
| 269 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 270 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 271 | tfoot { |
| 272 | font-weight: bold; |
| 273 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 274 | td > div.verse { |
| 275 | white-space: pre; |
| 276 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 277 | |
| 278 | div.hdlist { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 279 | margin-top: 0.8em; |
| 280 | margin-bottom: 0.8em; |
| 281 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 282 | div.hdlist tr { |
| 283 | padding-bottom: 15px; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 284 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 285 | dt.hdlist1.strong, td.hdlist1.strong { |
| 286 | font-weight: bold; |
| 287 | } |
| 288 | td.hdlist1 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 289 | vertical-align: top; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 290 | font-style: normal; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 291 | padding-right: 0.8em; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 292 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 293 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 294 | td.hdlist2 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 295 | vertical-align: top; |
| 296 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 297 | div.hdlist.compact tr { |
| 298 | margin: 0; |
| 299 | padding-bottom: 0; |
| 300 | } |
| 301 | |
| 302 | .comment { |
| 303 | background: yellow; |
| 304 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 305 | |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 306 | .footnote, .footnoteref { |
| 307 | font-size: 0.8em; |
| 308 | } |
| 309 | |
| 310 | span.footnote, span.footnoteref { |
| 311 | vertical-align: super; |
| 312 | } |
| 313 | |
| 314 | #footnotes { |
| 315 | margin: 20px 0 20px 0; |
| 316 | padding: 7px 0 0 0; |
| 317 | } |
| 318 | |
| 319 | #footnotes div.footnote { |
| 320 | margin: 0 0 5px 0; |
| 321 | } |
| 322 | |
| 323 | #footnotes hr { |
| 324 | border: none; |
| 325 | border-top: 1px solid silver; |
| 326 | height: 1px; |
| 327 | text-align: left; |
| 328 | margin-left: 0; |
| 329 | width: 20%; |
| 330 | min-width: 100px; |
| 331 | } |
| 332 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 333 | div.colist td { |
| 334 | padding-right: 0.5em; |
| 335 | padding-bottom: 0.3em; |
| 336 | vertical-align: top; |
| 337 | } |
| 338 | div.colist td img { |
| 339 | margin-top: 0.3em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 340 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 341 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 342 | @media print { |
| 343 | #footer-badges { display: none; } |
| 344 | } |
| 345 | |
| 346 | #toc { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 347 | margin-bottom: 2.5em; |
| 348 | } |
| 349 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 350 | #toctitle { |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 351 | color: #527bbd; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 352 | font-size: 1.1em; |
| 353 | font-weight: bold; |
| 354 | margin-top: 1.0em; |
| 355 | margin-bottom: 0.1em; |
| 356 | } |
| 357 | |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 358 | div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 359 | margin-top: 0; |
| 360 | margin-bottom: 0; |
| 361 | } |
| 362 | div.toclevel2 { |
| 363 | margin-left: 2em; |
| 364 | font-size: 0.9em; |
| 365 | } |
| 366 | div.toclevel3 { |
| 367 | margin-left: 4em; |
| 368 | font-size: 0.9em; |
| 369 | } |
| 370 | div.toclevel4 { |
| 371 | margin-left: 6em; |
| 372 | font-size: 0.9em; |
| 373 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 374 | |
| 375 | span.aqua { color: aqua; } |
| 376 | span.black { color: black; } |
| 377 | span.blue { color: blue; } |
| 378 | span.fuchsia { color: fuchsia; } |
| 379 | span.gray { color: gray; } |
| 380 | span.green { color: green; } |
| 381 | span.lime { color: lime; } |
| 382 | span.maroon { color: maroon; } |
| 383 | span.navy { color: navy; } |
| 384 | span.olive { color: olive; } |
| 385 | span.purple { color: purple; } |
| 386 | span.red { color: red; } |
| 387 | span.silver { color: silver; } |
| 388 | span.teal { color: teal; } |
| 389 | span.white { color: white; } |
| 390 | span.yellow { color: yellow; } |
| 391 | |
| 392 | span.aqua-background { background: aqua; } |
| 393 | span.black-background { background: black; } |
| 394 | span.blue-background { background: blue; } |
| 395 | span.fuchsia-background { background: fuchsia; } |
| 396 | span.gray-background { background: gray; } |
| 397 | span.green-background { background: green; } |
| 398 | span.lime-background { background: lime; } |
| 399 | span.maroon-background { background: maroon; } |
| 400 | span.navy-background { background: navy; } |
| 401 | span.olive-background { background: olive; } |
| 402 | span.purple-background { background: purple; } |
| 403 | span.red-background { background: red; } |
| 404 | span.silver-background { background: silver; } |
| 405 | span.teal-background { background: teal; } |
| 406 | span.white-background { background: white; } |
| 407 | span.yellow-background { background: yellow; } |
| 408 | |
| 409 | span.big { font-size: 2em; } |
| 410 | span.small { font-size: 0.6em; } |
| 411 | |
| 412 | span.underline { text-decoration: underline; } |
| 413 | span.overline { text-decoration: overline; } |
| 414 | span.line-through { text-decoration: line-through; } |
| 415 | |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 416 | div.unbreakable { page-break-inside: avoid; } |
| 417 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 418 | |
| 419 | /* |
| 420 | * xhtml11 specific |
| 421 | * |
| 422 | * */ |
| 423 | |
| 424 | div.tableblock { |
| 425 | margin-top: 1.0em; |
| 426 | margin-bottom: 1.5em; |
| 427 | } |
| 428 | div.tableblock > table { |
| 429 | border: 3px solid #527bbd; |
| 430 | } |
| 431 | thead, p.table.header { |
| 432 | font-weight: bold; |
| 433 | color: #527bbd; |
| 434 | } |
| 435 | p.table { |
| 436 | margin-top: 0; |
| 437 | } |
| 438 | /* Because the table frame attribute is overriden by CSS in most browsers. */ |
| 439 | div.tableblock > table[frame="void"] { |
| 440 | border-style: none; |
| 441 | } |
| 442 | div.tableblock > table[frame="hsides"] { |
| 443 | border-left-style: none; |
| 444 | border-right-style: none; |
| 445 | } |
| 446 | div.tableblock > table[frame="vsides"] { |
| 447 | border-top-style: none; |
| 448 | border-bottom-style: none; |
| 449 | } |
| 450 | |
| 451 | |
| 452 | /* |
| 453 | * html5 specific |
| 454 | * |
| 455 | * */ |
| 456 | |
| 457 | table.tableblock { |
| 458 | margin-top: 1.0em; |
| 459 | margin-bottom: 1.5em; |
| 460 | } |
| 461 | thead, p.tableblock.header { |
| 462 | font-weight: bold; |
| 463 | color: #527bbd; |
| 464 | } |
| 465 | p.tableblock { |
| 466 | margin-top: 0; |
| 467 | } |
| 468 | table.tableblock { |
| 469 | border-width: 3px; |
| 470 | border-spacing: 0px; |
| 471 | border-style: solid; |
| 472 | border-color: #527bbd; |
| 473 | border-collapse: collapse; |
| 474 | } |
| 475 | th.tableblock, td.tableblock { |
| 476 | border-width: 1px; |
| 477 | padding: 4px; |
| 478 | border-style: solid; |
| 479 | border-color: #527bbd; |
| 480 | } |
| 481 | |
| 482 | table.tableblock.frame-topbot { |
| 483 | border-left-style: hidden; |
| 484 | border-right-style: hidden; |
| 485 | } |
| 486 | table.tableblock.frame-sides { |
| 487 | border-top-style: hidden; |
| 488 | border-bottom-style: hidden; |
| 489 | } |
| 490 | table.tableblock.frame-none { |
| 491 | border-style: hidden; |
| 492 | } |
| 493 | |
| 494 | th.tableblock.halign-left, td.tableblock.halign-left { |
| 495 | text-align: left; |
| 496 | } |
| 497 | th.tableblock.halign-center, td.tableblock.halign-center { |
| 498 | text-align: center; |
| 499 | } |
| 500 | th.tableblock.halign-right, td.tableblock.halign-right { |
| 501 | text-align: right; |
| 502 | } |
| 503 | |
| 504 | th.tableblock.valign-top, td.tableblock.valign-top { |
| 505 | vertical-align: top; |
| 506 | } |
| 507 | th.tableblock.valign-middle, td.tableblock.valign-middle { |
| 508 | vertical-align: middle; |
| 509 | } |
| 510 | th.tableblock.valign-bottom, td.tableblock.valign-bottom { |
| 511 | vertical-align: bottom; |
| 512 | } |
| 513 | |
| 514 | |
| 515 | /* |
| 516 | * manpage specific |
| 517 | * |
| 518 | * */ |
| 519 | |
| 520 | body.manpage h1 { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 521 | padding-top: 0.5em; |
| 522 | padding-bottom: 0.5em; |
| 523 | border-top: 2px solid silver; |
| 524 | border-bottom: 2px solid silver; |
| 525 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 526 | body.manpage h2 { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 527 | border-style: none; |
| 528 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 529 | body.manpage div.sectionbody { |
| 530 | margin-left: 3em; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 531 | } |
| 532 | |
| 533 | @media print { |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 534 | body.manpage div#toc { display: none; } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 535 | } |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 536 | |
| 537 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 538 | </style> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 539 | <script type="text/javascript"> |
| 540 | /*<![CDATA[*/ |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 541 | var asciidoc = { // Namespace. |
| 542 | |
| 543 | ///////////////////////////////////////////////////////////////////// |
| 544 | // Table Of Contents generator |
| 545 | ///////////////////////////////////////////////////////////////////// |
| 546 | |
| 547 | /* Author: Mihai Bazon, September 2002 |
| 548 | * http://students.infoiasi.ro/~mishoo |
| 549 | * |
| 550 | * Table Of Content generator |
| 551 | * Version: 0.4 |
| 552 | * |
| 553 | * Feel free to use this script under the terms of the GNU General Public |
| 554 | * License, as long as you do not remove or alter this notice. |
| 555 | */ |
| 556 | |
| 557 | /* modified by Troy D. Hanson, September 2006. License: GPL */ |
| 558 | /* modified by Stuart Rackham, 2006, 2009. License: GPL */ |
| 559 | |
| 560 | // toclevels = 1..4. |
| 561 | toc: function (toclevels) { |
| 562 | |
| 563 | function getText(el) { |
| 564 | var text = ""; |
| 565 | for (var i = el.firstChild; i != null; i = i.nextSibling) { |
| 566 | if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants. |
| 567 | text += i.data; |
| 568 | else if (i.firstChild != null) |
| 569 | text += getText(i); |
| 570 | } |
| 571 | return text; |
| 572 | } |
| 573 | |
| 574 | function TocEntry(el, text, toclevel) { |
| 575 | this.element = el; |
| 576 | this.text = text; |
| 577 | this.toclevel = toclevel; |
| 578 | } |
| 579 | |
| 580 | function tocEntries(el, toclevels) { |
| 581 | var result = new Array; |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 582 | var re = new RegExp('[hH]([1-'+(toclevels+1)+'])'); |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 583 | // Function that scans the DOM tree for header elements (the DOM2 |
| 584 | // nodeIterator API would be a better technique but not supported by all |
| 585 | // browsers). |
| 586 | var iterate = function (el) { |
| 587 | for (var i = el.firstChild; i != null; i = i.nextSibling) { |
| 588 | if (i.nodeType == 1 /* Node.ELEMENT_NODE */) { |
| 589 | var mo = re.exec(i.tagName); |
| 590 | if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") { |
| 591 | result[result.length] = new TocEntry(i, getText(i), mo[1]-1); |
| 592 | } |
| 593 | iterate(i); |
| 594 | } |
| 595 | } |
| 596 | } |
| 597 | iterate(el); |
| 598 | return result; |
| 599 | } |
| 600 | |
| 601 | var toc = document.getElementById("toc"); |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 602 | if (!toc) { |
| 603 | return; |
| 604 | } |
| 605 | |
| 606 | // Delete existing TOC entries in case we're reloading the TOC. |
| 607 | var tocEntriesToRemove = []; |
| 608 | var i; |
| 609 | for (i = 0; i < toc.childNodes.length; i++) { |
| 610 | var entry = toc.childNodes[i]; |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 611 | if (entry.nodeName.toLowerCase() == 'div' |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 612 | && entry.getAttribute("class") |
| 613 | && entry.getAttribute("class").match(/^toclevel/)) |
| 614 | tocEntriesToRemove.push(entry); |
| 615 | } |
| 616 | for (i = 0; i < tocEntriesToRemove.length; i++) { |
| 617 | toc.removeChild(tocEntriesToRemove[i]); |
| 618 | } |
| 619 | |
| 620 | // Rebuild TOC entries. |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 621 | var entries = tocEntries(document.getElementById("content"), toclevels); |
| 622 | for (var i = 0; i < entries.length; ++i) { |
| 623 | var entry = entries[i]; |
| 624 | if (entry.element.id == "") |
| 625 | entry.element.id = "_toc_" + i; |
| 626 | var a = document.createElement("a"); |
| 627 | a.href = "#" + entry.element.id; |
| 628 | a.appendChild(document.createTextNode(entry.text)); |
| 629 | var div = document.createElement("div"); |
| 630 | div.appendChild(a); |
| 631 | div.className = "toclevel" + entry.toclevel; |
| 632 | toc.appendChild(div); |
| 633 | } |
| 634 | if (entries.length == 0) |
| 635 | toc.parentNode.removeChild(toc); |
| 636 | }, |
| 637 | |
| 638 | |
| 639 | ///////////////////////////////////////////////////////////////////// |
| 640 | // Footnotes generator |
| 641 | ///////////////////////////////////////////////////////////////////// |
| 642 | |
| 643 | /* Based on footnote generation code from: |
| 644 | * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html |
| 645 | */ |
| 646 | |
| 647 | footnotes: function () { |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 648 | // Delete existing footnote entries in case we're reloading the footnodes. |
| 649 | var i; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 650 | var noteholder = document.getElementById("footnotes"); |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 651 | if (!noteholder) { |
| 652 | return; |
| 653 | } |
| 654 | var entriesToRemove = []; |
| 655 | for (i = 0; i < noteholder.childNodes.length; i++) { |
| 656 | var entry = noteholder.childNodes[i]; |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 657 | if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote") |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 658 | entriesToRemove.push(entry); |
| 659 | } |
| 660 | for (i = 0; i < entriesToRemove.length; i++) { |
| 661 | noteholder.removeChild(entriesToRemove[i]); |
| 662 | } |
| 663 | |
| 664 | // Rebuild footnote entries. |
| 665 | var cont = document.getElementById("content"); |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 666 | var spans = cont.getElementsByTagName("span"); |
| 667 | var refs = {}; |
| 668 | var n = 0; |
| 669 | for (i=0; i<spans.length; i++) { |
| 670 | if (spans[i].className == "footnote") { |
| 671 | n++; |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 672 | var note = spans[i].getAttribute("data-note"); |
| 673 | if (!note) { |
| 674 | // Use [\s\S] in place of . so multi-line matches work. |
| 675 | // Because JavaScript has no s (dotall) regex flag. |
| 676 | note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1]; |
| 677 | spans[i].innerHTML = |
| 678 | "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n + |
| 679 | "' title='View footnote' class='footnote'>" + n + "</a>]"; |
| 680 | spans[i].setAttribute("data-note", note); |
| 681 | } |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 682 | noteholder.innerHTML += |
| 683 | "<div class='footnote' id='_footnote_" + n + "'>" + |
| 684 | "<a href='#_footnoteref_" + n + "' title='Return to text'>" + |
| 685 | n + "</a>. " + note + "</div>"; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 686 | var id =spans[i].getAttribute("id"); |
| 687 | if (id != null) refs["#"+id] = n; |
| 688 | } |
| 689 | } |
| 690 | if (n == 0) |
| 691 | noteholder.parentNode.removeChild(noteholder); |
| 692 | else { |
| 693 | // Process footnoterefs. |
| 694 | for (i=0; i<spans.length; i++) { |
| 695 | if (spans[i].className == "footnoteref") { |
| 696 | var href = spans[i].getElementsByTagName("a")[0].getAttribute("href"); |
| 697 | href = href.match(/#.*/)[0]; // Because IE return full URL. |
| 698 | n = refs[href]; |
| 699 | spans[i].innerHTML = |
| 700 | "[<a href='#_footnote_" + n + |
| 701 | "' title='View footnote' class='footnote'>" + n + "</a>]"; |
| 702 | } |
| 703 | } |
| 704 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 705 | }, |
| 706 | |
| 707 | install: function(toclevels) { |
| 708 | var timerId; |
| 709 | |
| 710 | function reinstall() { |
| 711 | asciidoc.footnotes(); |
| 712 | if (toclevels) { |
| 713 | asciidoc.toc(toclevels); |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | function reinstallAndRemoveTimer() { |
| 718 | clearInterval(timerId); |
| 719 | reinstall(); |
| 720 | } |
| 721 | |
| 722 | timerId = setInterval(reinstall, 500); |
| 723 | if (document.addEventListener) |
| 724 | document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false); |
| 725 | else |
| 726 | window.onload = reinstallAndRemoveTimer; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 727 | } |
| 728 | |
| 729 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 730 | asciidoc.install(); |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 731 | /*]]>*/ |
| 732 | </script> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 733 | </head> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 734 | <body class="manpage"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 735 | <div id="header"> |
| 736 | <h1> |
| 737 | git-diff-index(1) Manual Page |
| 738 | </h1> |
| 739 | <h2>NAME</h2> |
| 740 | <div class="sectionbody"> |
| 741 | <p>git-diff-index - |
Junio C Hamano | 7e590a1 | 2013-06-02 23:46:52 | [diff] [blame] | 742 | Compare a tree to the working tree or index |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 743 | </p> |
| 744 | </div> |
| 745 | </div> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 746 | <div id="content"> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 747 | <div class="sect1"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 748 | <h2 id="_synopsis">SYNOPSIS</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 749 | <div class="sectionbody"> |
Junio C Hamano | 15567bc | 2011-07-23 00:51:59 | [diff] [blame] | 750 | <div class="verseblock"> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 751 | <pre class="content"><em>git diff-index</em> [-m] [--cached] [<common diff options>] <tree-ish> [<path>…]</pre> |
| 752 | <div class="attribution"> |
Junio C Hamano | 15567bc | 2011-07-23 00:51:59 | [diff] [blame] | 753 | </div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 754 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 755 | </div> |
| 756 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 757 | <h2 id="_description">DESCRIPTION</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 758 | <div class="sectionbody"> |
Junio C Hamano | 7e590a1 | 2013-06-02 23:46:52 | [diff] [blame] | 759 | <div class="paragraph"><p>Compares the content and mode of the blobs found in a tree object |
| 760 | with the corresponding tracked files in the working tree, or with the |
| 761 | corresponding paths in the index. When <path> arguments are present, |
| 762 | compares only paths matching those patterns. Otherwise all tracked |
| 763 | files are compared.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 764 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 765 | </div> |
| 766 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 767 | <h2 id="_options">OPTIONS</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 768 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 769 | <div class="dlist"><dl> |
| 770 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 771 | -p |
| 772 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 773 | <dt class="hdlist1"> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 774 | -u |
| 775 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 776 | <dt class="hdlist1"> |
Junio C Hamano | e97d577 | 2010-05-19 08:13:58 | [diff] [blame] | 777 | --patch |
| 778 | </dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 779 | <dd> |
| 780 | <p> |
Junio C Hamano | ff97979 | 2007-11-16 10:11:30 | [diff] [blame] | 781 | Generate patch (see section on generating patches). |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 782 | </p> |
| 783 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 784 | <dt class="hdlist1"> |
Junio C Hamano | 58f587a | 2013-07-22 19:20:59 | [diff] [blame] | 785 | -s |
| 786 | </dt> |
| 787 | <dt class="hdlist1"> |
| 788 | --no-patch |
| 789 | </dt> |
| 790 | <dd> |
| 791 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 792 | Suppress diff output. Useful for commands like <code>git show</code> that |
| 793 | show the patch by default, or to cancel the effect of <code>--patch</code>. |
Junio C Hamano | 58f587a | 2013-07-22 19:20:59 | [diff] [blame] | 794 | </p> |
| 795 | </dd> |
| 796 | <dt class="hdlist1"> |
Junio C Hamano | 6936156 | 2007-07-26 02:14:34 | [diff] [blame] | 797 | -U<n> |
| 798 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 799 | <dt class="hdlist1"> |
Junio C Hamano | 6936156 | 2007-07-26 02:14:34 | [diff] [blame] | 800 | --unified=<n> |
| 801 | </dt> |
| 802 | <dd> |
| 803 | <p> |
| 804 | Generate diffs with <n> lines of context instead of |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 805 | the usual three. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 806 | Implies <code>-p</code>. |
Junio C Hamano | 6936156 | 2007-07-26 02:14:34 | [diff] [blame] | 807 | </p> |
| 808 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 809 | <dt class="hdlist1"> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 810 | --raw |
| 811 | </dt> |
| 812 | <dd> |
| 813 | <p> |
Junio C Hamano | 85f1fde | 2015-06-01 20:37:32 | [diff] [blame] | 814 | Generate the diff in raw format. |
Junio C Hamano | 1dbca52 | 2015-05-22 20:48:55 | [diff] [blame] | 815 | This is the default. |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 816 | </p> |
| 817 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 818 | <dt class="hdlist1"> |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 819 | --patch-with-raw |
| 820 | </dt> |
| 821 | <dd> |
| 822 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 823 | Synonym for <code>-p --raw</code>. |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 824 | </p> |
| 825 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 826 | <dt class="hdlist1"> |
Junio C Hamano | ad70bf0 | 2016-09-26 23:44:27 | [diff] [blame] | 827 | --indent-heuristic |
| 828 | </dt> |
| 829 | <dt class="hdlist1"> |
| 830 | --no-indent-heuristic |
| 831 | </dt> |
Junio C Hamano | 5f88833 | 2016-06-13 19:28:31 | [diff] [blame] | 832 | <dd> |
| 833 | <p> |
Junio C Hamano | ad70bf0 | 2016-09-26 23:44:27 | [diff] [blame] | 834 | These are to help debugging and tuning experimental heuristics |
| 835 | (which are off by default) that shift diff hunk boundaries to |
| 836 | make patches easier to read. |
Junio C Hamano | 5f88833 | 2016-06-13 19:28:31 | [diff] [blame] | 837 | </p> |
| 838 | </dd> |
| 839 | <dt class="hdlist1"> |
Junio C Hamano | 5a73f30 | 2011-10-14 05:58:34 | [diff] [blame] | 840 | --minimal |
| 841 | </dt> |
| 842 | <dd> |
| 843 | <p> |
| 844 | Spend extra time to make sure the smallest possible |
| 845 | diff is produced. |
| 846 | </p> |
| 847 | </dd> |
| 848 | <dt class="hdlist1"> |
Junio C Hamano | 20d47e3 | 2009-01-26 06:36:02 | [diff] [blame] | 849 | --patience |
| 850 | </dt> |
| 851 | <dd> |
| 852 | <p> |
| 853 | Generate a diff using the "patience diff" algorithm. |
| 854 | </p> |
| 855 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 856 | <dt class="hdlist1"> |
Junio C Hamano | aea9e6b | 2012-03-07 00:17:11 | [diff] [blame] | 857 | --histogram |
| 858 | </dt> |
| 859 | <dd> |
| 860 | <p> |
| 861 | Generate a diff using the "histogram diff" algorithm. |
| 862 | </p> |
| 863 | </dd> |
| 864 | <dt class="hdlist1"> |
Junio C Hamano | 80ad00d | 2013-02-18 00:19:03 | [diff] [blame] | 865 | --diff-algorithm={patience|minimal|histogram|myers} |
| 866 | </dt> |
| 867 | <dd> |
| 868 | <p> |
| 869 | Choose a diff algorithm. The variants are as follows: |
| 870 | </p> |
| 871 | <div class="openblock"> |
| 872 | <div class="content"> |
| 873 | <div class="dlist"><dl> |
| 874 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 875 | <code>default</code>, <code>myers</code> |
Junio C Hamano | 80ad00d | 2013-02-18 00:19:03 | [diff] [blame] | 876 | </dt> |
| 877 | <dd> |
| 878 | <p> |
| 879 | The basic greedy diff algorithm. Currently, this is the default. |
| 880 | </p> |
| 881 | </dd> |
| 882 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 883 | <code>minimal</code> |
Junio C Hamano | 80ad00d | 2013-02-18 00:19:03 | [diff] [blame] | 884 | </dt> |
| 885 | <dd> |
| 886 | <p> |
| 887 | Spend extra time to make sure the smallest possible diff is |
| 888 | produced. |
| 889 | </p> |
| 890 | </dd> |
| 891 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 892 | <code>patience</code> |
Junio C Hamano | 80ad00d | 2013-02-18 00:19:03 | [diff] [blame] | 893 | </dt> |
| 894 | <dd> |
| 895 | <p> |
| 896 | Use "patience diff" algorithm when generating patches. |
| 897 | </p> |
| 898 | </dd> |
| 899 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 900 | <code>histogram</code> |
Junio C Hamano | 80ad00d | 2013-02-18 00:19:03 | [diff] [blame] | 901 | </dt> |
| 902 | <dd> |
| 903 | <p> |
| 904 | This algorithm extends the patience algorithm to "support |
| 905 | low-occurrence common elements". |
| 906 | </p> |
| 907 | </dd> |
| 908 | </dl></div> |
| 909 | </div></div> |
| 910 | <div class="paragraph"><p>For instance, if you configured diff.algorithm variable to a |
| 911 | non-default value and want to use the default one, then you |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 912 | have to use <code>--diff-algorithm=default</code> option.</p></div> |
Junio C Hamano | 80ad00d | 2013-02-18 00:19:03 | [diff] [blame] | 913 | </dd> |
| 914 | <dt class="hdlist1"> |
Junio C Hamano | 4c4b012 | 2011-06-30 01:19:32 | [diff] [blame] | 915 | --stat[=<width>[,<name-width>[,<count>]]] |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 916 | </dt> |
| 917 | <dd> |
| 918 | <p> |
Junio C Hamano | aea9e6b | 2012-03-07 00:17:11 | [diff] [blame] | 919 | Generate a diffstat. By default, as much space as necessary |
| 920 | will be used for the filename part, and the rest for the graph |
| 921 | part. Maximum width defaults to terminal width, or 80 columns |
Junio C Hamano | 7f2b3cb | 2012-06-22 22:42:39 | [diff] [blame] | 922 | if not connected to a terminal, and can be overridden by |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 923 | <code><width></code>. The width of the filename part can be limited by |
| 924 | giving another width <code><name-width></code> after a comma. The width |
Junio C Hamano | aea9e6b | 2012-03-07 00:17:11 | [diff] [blame] | 925 | of the graph part can be limited by using |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 926 | <code>--stat-graph-width=<width></code> (affects all commands generating |
| 927 | a stat graph) or by setting <code>diff.statGraphWidth=<width></code> |
| 928 | (does not affect <code>git format-patch</code>). |
| 929 | By giving a third parameter <code><count></code>, you can limit the |
| 930 | output to the first <code><count></code> lines, followed by <code>...</code> if |
Junio C Hamano | aea9e6b | 2012-03-07 00:17:11 | [diff] [blame] | 931 | there are more. |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 932 | </p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 933 | <div class="paragraph"><p>These parameters can also be set individually with <code>--stat-width=<width></code>, |
| 934 | <code>--stat-name-width=<name-width></code> and <code>--stat-count=<count></code>.</p></div> |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 935 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 936 | <dt class="hdlist1"> |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 937 | --numstat |
| 938 | </dt> |
| 939 | <dd> |
| 940 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 941 | Similar to <code>--stat</code>, but shows number of added and |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 942 | deleted lines in decimal notation and pathname without |
Junio C Hamano | d793de5 | 2006-12-26 09:11:43 | [diff] [blame] | 943 | abbreviation, to make it more machine friendly. For |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 944 | binary files, outputs two <code>-</code> instead of saying |
| 945 | <code>0 0</code>. |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 946 | </p> |
| 947 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 948 | <dt class="hdlist1"> |
Junio C Hamano | 7d23f5e | 2006-12-16 07:44:04 | [diff] [blame] | 949 | --shortstat |
| 950 | </dt> |
| 951 | <dd> |
| 952 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 953 | Output only the last line of the <code>--stat</code> format containing total |
Junio C Hamano | 7d23f5e | 2006-12-16 07:44:04 | [diff] [blame] | 954 | number of modified files, as well as number of added and deleted |
| 955 | lines. |
| 956 | </p> |
| 957 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 958 | <dt class="hdlist1"> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 959 | --dirstat[=<param1,param2,…>] |
Junio C Hamano | 6a45be9 | 2008-04-22 08:19:03 | [diff] [blame] | 960 | </dt> |
| 961 | <dd> |
| 962 | <p> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 963 | Output the distribution of relative amount of changes for each |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 964 | sub-directory. The behavior of <code>--dirstat</code> can be customized by |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 965 | passing it a comma separated list of parameters. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 966 | The defaults are controlled by the <code>diff.dirstat</code> configuration |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 967 | variable (see <a href="git-config.html">git-config(1)</a>). |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 968 | The following parameters are available: |
Junio C Hamano | 6a45be9 | 2008-04-22 08:19:03 | [diff] [blame] | 969 | </p> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 970 | <div class="openblock"> |
| 971 | <div class="content"> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 972 | <div class="dlist"><dl> |
| 973 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 974 | <code>changes</code> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 975 | </dt> |
| 976 | <dd> |
| 977 | <p> |
| 978 | Compute the dirstat numbers by counting the lines that have been |
| 979 | removed from the source, or added to the destination. This ignores |
| 980 | the amount of pure code movements within a file. In other words, |
| 981 | rearranging lines in a file is not counted as much as other changes. |
| 982 | This is the default behavior when no parameter is given. |
| 983 | </p> |
Junio C Hamano | 6a45be9 | 2008-04-22 08:19:03 | [diff] [blame] | 984 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 985 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 986 | <code>lines</code> |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 987 | </dt> |
| 988 | <dd> |
| 989 | <p> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 990 | Compute the dirstat numbers by doing the regular line-based diff |
| 991 | analysis, and summing the removed/added line counts. (For binary |
| 992 | files, count 64-byte chunks instead, since binary files have no |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 993 | natural concept of lines). This is a more expensive <code>--dirstat</code> |
| 994 | behavior than the <code>changes</code> behavior, but it does count rearranged |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 995 | lines within a file as much as other changes. The resulting output |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 996 | is consistent with what you get from the other <code>--*stat</code> options. |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 997 | </p> |
| 998 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 999 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1000 | <code>files</code> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 1001 | </dt> |
| 1002 | <dd> |
| 1003 | <p> |
| 1004 | Compute the dirstat numbers by counting the number of files changed. |
| 1005 | Each changed file counts equally in the dirstat analysis. This is |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1006 | the computationally cheapest <code>--dirstat</code> behavior, since it does |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 1007 | not have to look at the file contents at all. |
| 1008 | </p> |
| 1009 | </dd> |
| 1010 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1011 | <code>cumulative</code> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 1012 | </dt> |
| 1013 | <dd> |
| 1014 | <p> |
| 1015 | Count changes in a child directory for the parent directory as well. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1016 | Note that when using <code>cumulative</code>, the sum of the percentages |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 1017 | reported may exceed 100%. The default (non-cumulative) behavior can |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1018 | be specified with the <code>noncumulative</code> parameter. |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 1019 | </p> |
| 1020 | </dd> |
| 1021 | <dt class="hdlist1"> |
| 1022 | <limit> |
| 1023 | </dt> |
| 1024 | <dd> |
| 1025 | <p> |
| 1026 | An integer parameter specifies a cut-off percent (3% by default). |
| 1027 | Directories contributing less than this percentage of the changes |
| 1028 | are not shown in the output. |
| 1029 | </p> |
| 1030 | </dd> |
| 1031 | </dl></div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 1032 | </div></div> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 1033 | <div class="paragraph"><p>Example: The following will count changed files, while ignoring |
| 1034 | directories with less than 10% of the total amount of changed files, |
| 1035 | and accumulating child directory counts in the parent directories: |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1036 | <code>--dirstat=files,10,cumulative</code>.</p></div> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 1037 | </dd> |
| 1038 | <dt class="hdlist1"> |
Junio C Hamano | 6959c6c | 2006-05-17 10:34:11 | [diff] [blame] | 1039 | --summary |
| 1040 | </dt> |
| 1041 | <dd> |
| 1042 | <p> |
| 1043 | Output a condensed summary of extended header information |
| 1044 | such as creations, renames and mode changes. |
| 1045 | </p> |
| 1046 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1047 | <dt class="hdlist1"> |
Junio C Hamano | d1308c9 | 2006-04-16 11:01:09 | [diff] [blame] | 1048 | --patch-with-stat |
| 1049 | </dt> |
| 1050 | <dd> |
| 1051 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1052 | Synonym for <code>-p --stat</code>. |
Junio C Hamano | d1308c9 | 2006-04-16 11:01:09 | [diff] [blame] | 1053 | </p> |
| 1054 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1055 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1056 | -z |
| 1057 | </dt> |
| 1058 | <dd> |
| 1059 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1060 | When <code>--raw</code>, <code>--numstat</code>, <code>--name-only</code> or <code>--name-status</code> has been |
Junio C Hamano | 0c053e8 | 2010-04-19 06:46:34 | [diff] [blame] | 1061 | given, do not munge pathnames and use NULs as output field terminators. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1062 | </p> |
Junio C Hamano | 0f6f3bf | 2017-03-13 07:01:53 | [diff] [blame] | 1063 | <div class="paragraph"><p>Without this option, pathnames with "unusual" characters are quoted as |
| 1064 | explained for the configuration variable <code>core.quotePath</code> (see |
| 1065 | <a href="git-config.html">git-config(1)</a>).</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1066 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1067 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1068 | --name-only |
| 1069 | </dt> |
| 1070 | <dd> |
| 1071 | <p> |
| 1072 | Show only names of changed files. |
| 1073 | </p> |
| 1074 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1075 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1076 | --name-status |
| 1077 | </dt> |
| 1078 | <dd> |
| 1079 | <p> |
Junio C Hamano | a9aee78 | 2008-04-23 16:09:20 | [diff] [blame] | 1080 | Show only names and status of changed files. See the description |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1081 | of the <code>--diff-filter</code> option on what the status letters mean. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1082 | </p> |
| 1083 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1084 | <dt class="hdlist1"> |
Junio C Hamano | c21ab05 | 2009-10-31 04:03:55 | [diff] [blame] | 1085 | --submodule[=<format>] |
| 1086 | </dt> |
| 1087 | <dd> |
| 1088 | <p> |
Junio C Hamano | cd45166 | 2016-09-13 00:54:09 | [diff] [blame] | 1089 | Specify how differences in submodules are shown. When specifying |
| 1090 | <code>--submodule=short</code> the <em>short</em> format is used. This format just |
| 1091 | shows the names of the commits at the beginning and end of the range. |
| 1092 | When <code>--submodule</code> or <code>--submodule=log</code> is specified, the <em>log</em> |
| 1093 | format is used. This format lists the commits in the range like |
| 1094 | <a href="git-submodule.html">git-submodule(1)</a> <code>summary</code> does. When <code>--submodule=diff</code> |
| 1095 | is specified, the <em>diff</em> format is used. This format shows an |
| 1096 | inline diff of the changes in the submodule contents between the |
| 1097 | commit range. Defaults to <code>diff.submodule</code> or the <em>short</em> format |
| 1098 | if the config option is unset. |
Junio C Hamano | c21ab05 | 2009-10-31 04:03:55 | [diff] [blame] | 1099 | </p> |
| 1100 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1101 | <dt class="hdlist1"> |
Junio C Hamano | 4aa0bcc | 2010-03-03 05:13:12 | [diff] [blame] | 1102 | --color[=<when>] |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 1103 | </dt> |
| 1104 | <dd> |
| 1105 | <p> |
| 1106 | Show colored diff. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1107 | <code>--color</code> (i.e. without <em>=<when></em>) is the same as <code>--color=always</code>. |
| 1108 | <em><when></em> can be one of <code>always</code>, <code>never</code>, or <code>auto</code>. |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 1109 | </p> |
| 1110 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1111 | <dt class="hdlist1"> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 1112 | --no-color |
| 1113 | </dt> |
| 1114 | <dd> |
| 1115 | <p> |
Junio C Hamano | 5f2627d | 2011-05-06 20:23:48 | [diff] [blame] | 1116 | Turn off colored diff. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1117 | It is the same as <code>--color=never</code>. |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 1118 | </p> |
| 1119 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1120 | <dt class="hdlist1"> |
Junio C Hamano | fb1fdf1 | 2017-08-27 06:14:59 | [diff] [blame] | 1121 | --color-moved[=<mode>] |
| 1122 | </dt> |
| 1123 | <dd> |
| 1124 | <p> |
| 1125 | Moved lines of code are colored differently. |
| 1126 | The <mode> defaults to <em>no</em> if the option is not given |
| 1127 | and to <em>zebra</em> if the option with no mode is given. |
| 1128 | The mode must be one of: |
| 1129 | </p> |
| 1130 | <div class="openblock"> |
| 1131 | <div class="content"> |
| 1132 | <div class="dlist"><dl> |
| 1133 | <dt class="hdlist1"> |
| 1134 | no |
| 1135 | </dt> |
| 1136 | <dd> |
| 1137 | <p> |
| 1138 | Moved lines are not highlighted. |
| 1139 | </p> |
| 1140 | </dd> |
| 1141 | <dt class="hdlist1"> |
| 1142 | default |
| 1143 | </dt> |
| 1144 | <dd> |
| 1145 | <p> |
| 1146 | Is a synonym for <code>zebra</code>. This may change to a more sensible mode |
| 1147 | in the future. |
| 1148 | </p> |
| 1149 | </dd> |
| 1150 | <dt class="hdlist1"> |
| 1151 | plain |
| 1152 | </dt> |
| 1153 | <dd> |
| 1154 | <p> |
| 1155 | Any line that is added in one location and was removed |
| 1156 | in another location will be colored with <em>color.diff.newMoved</em>. |
| 1157 | Similarly <em>color.diff.oldMoved</em> will be used for removed lines |
| 1158 | that are added somewhere else in the diff. This mode picks up any |
| 1159 | moved line, but it is not very useful in a review to determine |
| 1160 | if a block of code was moved without permutation. |
| 1161 | </p> |
| 1162 | </dd> |
| 1163 | <dt class="hdlist1"> |
| 1164 | zebra |
| 1165 | </dt> |
| 1166 | <dd> |
| 1167 | <p> |
| 1168 | Blocks of moved text of at least 20 alphanumeric characters |
| 1169 | are detected greedily. The detected blocks are |
| 1170 | painted using either the <em>color.diff.{old,new}Moved</em> color or |
| 1171 | <em>color.diff.{old,new}MovedAlternative</em>. The change between |
| 1172 | the two colors indicates that a new block was detected. |
| 1173 | </p> |
| 1174 | </dd> |
| 1175 | <dt class="hdlist1"> |
| 1176 | dimmed_zebra |
| 1177 | </dt> |
| 1178 | <dd> |
| 1179 | <p> |
| 1180 | Similar to <em>zebra</em>, but additional dimming of uninteresting parts |
| 1181 | of moved code is performed. The bordering lines of two adjacent |
| 1182 | blocks are considered interesting, the rest is uninteresting. |
| 1183 | </p> |
| 1184 | </dd> |
| 1185 | </dl></div> |
| 1186 | </div></div> |
| 1187 | </dd> |
| 1188 | <dt class="hdlist1"> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1189 | --word-diff[=<mode>] |
Junio C Hamano | 85e45fa | 2006-08-13 07:47:41 | [diff] [blame] | 1190 | </dt> |
| 1191 | <dd> |
| 1192 | <p> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1193 | Show a word diff, using the <mode> to delimit changed words. |
| 1194 | By default, words are delimited by whitespace; see |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1195 | <code>--word-diff-regex</code> below. The <mode> defaults to <em>plain</em>, and |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1196 | must be one of: |
Junio C Hamano | 85e45fa | 2006-08-13 07:47:41 | [diff] [blame] | 1197 | </p> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 1198 | <div class="openblock"> |
| 1199 | <div class="content"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1200 | <div class="dlist"><dl> |
| 1201 | <dt class="hdlist1"> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1202 | color |
| 1203 | </dt> |
| 1204 | <dd> |
| 1205 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1206 | Highlight changed words using only colors. Implies <code>--color</code>. |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1207 | </p> |
| 1208 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1209 | <dt class="hdlist1"> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1210 | plain |
| 1211 | </dt> |
| 1212 | <dd> |
| 1213 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1214 | Show words as <code>[-removed-]</code> and <code>{+added+}</code>. Makes no |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1215 | attempts to escape the delimiters if they appear in the input, |
| 1216 | so the output may be ambiguous. |
| 1217 | </p> |
| 1218 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1219 | <dt class="hdlist1"> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1220 | porcelain |
| 1221 | </dt> |
| 1222 | <dd> |
| 1223 | <p> |
| 1224 | Use a special line-based format intended for script |
| 1225 | consumption. Added/removed/unchanged runs are printed in the |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1226 | usual unified diff format, starting with a <code>+</code>/<code>-</code>/` ` |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1227 | character at the beginning of the line and extending to the |
| 1228 | end of the line. Newlines in the input are represented by a |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1229 | tilde <code>~</code> on a line of its own. |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1230 | </p> |
| 1231 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1232 | <dt class="hdlist1"> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1233 | none |
| 1234 | </dt> |
| 1235 | <dd> |
| 1236 | <p> |
| 1237 | Disable word diff again. |
| 1238 | </p> |
| 1239 | </dd> |
| 1240 | </dl></div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 1241 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1242 | <div class="paragraph"><p>Note that despite the name of the first mode, color is used to |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1243 | highlight the changed parts in all modes if enabled.</p></div> |
| 1244 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1245 | <dt class="hdlist1"> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1246 | --word-diff-regex=<regex> |
| 1247 | </dt> |
| 1248 | <dd> |
| 1249 | <p> |
| 1250 | Use <regex> to decide what a word is, instead of considering |
| 1251 | runs of non-whitespace to be a word. Also implies |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1252 | <code>--word-diff</code> unless it was already enabled. |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1253 | </p> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1254 | <div class="paragraph"><p>Every non-overlapping match of the |
Junio C Hamano | 20d47e3 | 2009-01-26 06:36:02 | [diff] [blame] | 1255 | <regex> is considered a word. Anything between these matches is |
| 1256 | considered whitespace and ignored(!) for the purposes of finding |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1257 | differences. You may want to append <code>|[^[:space:]]</code> to your regular |
Junio C Hamano | 20d47e3 | 2009-01-26 06:36:02 | [diff] [blame] | 1258 | expression to make sure that it matches all non-whitespace characters. |
| 1259 | A match that contains a newline is silently truncated(!) at the |
| 1260 | newline.</p></div> |
Junio C Hamano | 713eded | 2015-12-03 00:24:02 | [diff] [blame] | 1261 | <div class="paragraph"><p>For example, <code>--word-diff-regex=.</code> will treat each character as a word |
| 1262 | and, correspondingly, show differences character by character.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1263 | <div class="paragraph"><p>The regex can also be set via a diff driver or configuration option, see |
Junio C Hamano | 198b1f1 | 2016-05-17 22:27:24 | [diff] [blame] | 1264 | <a href="gitattributes.html">gitattributes(5)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly |
Junio C Hamano | 20d47e3 | 2009-01-26 06:36:02 | [diff] [blame] | 1265 | overrides any diff driver or configuration setting. Diff drivers |
| 1266 | override configuration settings.</p></div> |
Junio C Hamano | 85e45fa | 2006-08-13 07:47:41 | [diff] [blame] | 1267 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1268 | <dt class="hdlist1"> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1269 | --color-words[=<regex>] |
| 1270 | </dt> |
| 1271 | <dd> |
| 1272 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1273 | Equivalent to <code>--word-diff=color</code> plus (if a regex was |
| 1274 | specified) <code>--word-diff-regex=<regex></code>. |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1275 | </p> |
| 1276 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1277 | <dt class="hdlist1"> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 1278 | --no-renames |
| 1279 | </dt> |
| 1280 | <dd> |
| 1281 | <p> |
| 1282 | Turn off rename detection, even when the configuration |
| 1283 | file gives the default to do so. |
| 1284 | </p> |
| 1285 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1286 | <dt class="hdlist1"> |
Junio C Hamano | a890c4f | 2007-01-28 10:29:21 | [diff] [blame] | 1287 | --check |
| 1288 | </dt> |
| 1289 | <dd> |
| 1290 | <p> |
Junio C Hamano | 84ea1e4 | 2016-04-08 21:53:48 | [diff] [blame] | 1291 | Warn if changes introduce conflict markers or whitespace errors. |
| 1292 | What are considered whitespace errors is controlled by <code>core.whitespace</code> |
Junio C Hamano | 6005bfa | 2011-06-23 00:51:22 | [diff] [blame] | 1293 | configuration. By default, trailing whitespaces (including |
| 1294 | lines that solely consist of whitespaces) and a space character |
| 1295 | that is immediately followed by a tab character inside the |
| 1296 | initial indent of the line are considered whitespace errors. |
| 1297 | Exits with non-zero status if problems are found. Not compatible |
| 1298 | with --exit-code. |
Junio C Hamano | a890c4f | 2007-01-28 10:29:21 | [diff] [blame] | 1299 | </p> |
| 1300 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1301 | <dt class="hdlist1"> |
Junio C Hamano | 8c5d594 | 2015-06-11 19:37:48 | [diff] [blame] | 1302 | --ws-error-highlight=<kind> |
| 1303 | </dt> |
| 1304 | <dd> |
| 1305 | <p> |
Junio C Hamano | 4b2a6c1 | 2017-08-22 18:32:37 | [diff] [blame] | 1306 | Highlight whitespace errors in the <code>context</code>, <code>old</code> or <code>new</code> |
| 1307 | lines of the diff. Multiple values are separated by comma, |
| 1308 | <code>none</code> resets previous values, <code>default</code> reset the list to |
| 1309 | <code>new</code> and <code>all</code> is a shorthand for <code>old,new,context</code>. When |
| 1310 | this option is not given, and the configuration variable |
| 1311 | <code>diff.wsErrorHighlight</code> is not set, only whitespace errors in |
| 1312 | <code>new</code> lines are highlighted. The whitespace errors are colored |
| 1313 | whith <code>color.diff.whitespace</code>. |
Junio C Hamano | 8c5d594 | 2015-06-11 19:37:48 | [diff] [blame] | 1314 | </p> |
| 1315 | </dd> |
| 1316 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1317 | --full-index |
| 1318 | </dt> |
| 1319 | <dd> |
| 1320 | <p> |
Junio C Hamano | 5cf43ca | 2008-08-20 09:14:14 | [diff] [blame] | 1321 | Instead of the first handful of characters, show the full |
| 1322 | pre- and post-image blob object names on the "index" |
| 1323 | line when generating patch format output. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1324 | </p> |
| 1325 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1326 | <dt class="hdlist1"> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 1327 | --binary |
| 1328 | </dt> |
| 1329 | <dd> |
| 1330 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1331 | In addition to <code>--full-index</code>, output a binary diff that |
| 1332 | can be applied with <code>git-apply</code>. |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 1333 | </p> |
| 1334 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1335 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1336 | --abbrev[=<n>] |
| 1337 | </dt> |
| 1338 | <dd> |
| 1339 | <p> |
| 1340 | Instead of showing the full 40-byte hexadecimal object |
| 1341 | name in diff-raw format output and diff-tree header |
Junio C Hamano | 6efe302 | 2009-01-13 16:47:56 | [diff] [blame] | 1342 | lines, show only a partial prefix. This is |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1343 | independent of the <code>--full-index</code> option above, which controls |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1344 | the diff-patch output format. Non default number of |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1345 | digits can be specified with <code>--abbrev=<n></code>. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1346 | </p> |
| 1347 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1348 | <dt class="hdlist1"> |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1349 | -B[<n>][/<m>] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1350 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1351 | <dt class="hdlist1"> |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 1352 | --break-rewrites[=[<n>][/<m>]] |
| 1353 | </dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1354 | <dd> |
| 1355 | <p> |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1356 | Break complete rewrite changes into pairs of delete and |
| 1357 | create. This serves two purposes: |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1358 | </p> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1359 | <div class="paragraph"><p>It affects the way a change that amounts to a total rewrite of a file |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1360 | not as a series of deletion and insertion mixed together with a very |
| 1361 | few lines that happen to match textually as the context, but as a |
| 1362 | single deletion of everything old followed by a single insertion of |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1363 | everything new, and the number <code>m</code> controls this aspect of the -B |
| 1364 | option (defaults to 60%). <code>-B/70%</code> specifies that less than 30% of the |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 1365 | original should remain in the result for Git to consider it a total |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1366 | rewrite (i.e. otherwise the resulting patch will be a series of |
| 1367 | deletion and insertion mixed together with context lines).</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1368 | <div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1369 | source of a rename (usually -M only considers a file that disappeared |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1370 | as the source of a rename), and the number <code>n</code> controls this aspect of |
| 1371 | the -B option (defaults to 50%). <code>-B20%</code> specifies that a change with |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1372 | addition and deletion compared to 20% or more of the file’s size are |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1373 | eligible for being picked up as a possible source of a rename to |
| 1374 | another file.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1375 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1376 | <dt class="hdlist1"> |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1377 | -M[<n>] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1378 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1379 | <dt class="hdlist1"> |
Junio C Hamano | 0d75e87 | 2010-12-17 06:57:26 | [diff] [blame] | 1380 | --find-renames[=<n>] |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 1381 | </dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1382 | <dd> |
| 1383 | <p> |
| 1384 | Detect renames. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1385 | If <code>n</code> is specified, it is a threshold on the similarity |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1386 | index (i.e. amount of addition/deletions compared to the |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1387 | file’s size). For example, <code>-M90%</code> means Git should consider a |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1388 | delete/add pair to be a rename if more than 90% of the file |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1389 | hasn’t changed. Without a <code>%</code> sign, the number is to be read as |
| 1390 | a fraction, with a decimal point before it. I.e., <code>-M5</code> becomes |
| 1391 | 0.5, and is thus the same as <code>-M50%</code>. Similarly, <code>-M05</code> is |
| 1392 | the same as <code>-M5%</code>. To limit detection to exact renames, use |
| 1393 | <code>-M100%</code>. The default similarity index is 50%. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1394 | </p> |
| 1395 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1396 | <dt class="hdlist1"> |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1397 | -C[<n>] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1398 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1399 | <dt class="hdlist1"> |
Junio C Hamano | 0d75e87 | 2010-12-17 06:57:26 | [diff] [blame] | 1400 | --find-copies[=<n>] |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 1401 | </dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1402 | <dd> |
| 1403 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1404 | Detect copies as well as renames. See also <code>--find-copies-harder</code>. |
| 1405 | If <code>n</code> is specified, it has the same meaning as for <code>-M<n></code>. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1406 | </p> |
| 1407 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1408 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1409 | --find-copies-harder |
| 1410 | </dt> |
| 1411 | <dd> |
| 1412 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1413 | For performance reasons, by default, <code>-C</code> option finds copies only |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1414 | if the original file of the copy was modified in the same |
| 1415 | changeset. This flag makes the command |
| 1416 | inspect unmodified files as candidates for the source of |
| 1417 | copy. This is a very expensive operation for large |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 1418 | projects, so use it with caution. Giving more than one |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1419 | <code>-C</code> option has the same effect. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1420 | </p> |
| 1421 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1422 | <dt class="hdlist1"> |
Junio C Hamano | b02377c | 2011-04-28 22:26:02 | [diff] [blame] | 1423 | -D |
| 1424 | </dt> |
| 1425 | <dt class="hdlist1"> |
| 1426 | --irreversible-delete |
| 1427 | </dt> |
| 1428 | <dd> |
| 1429 | <p> |
| 1430 | Omit the preimage for deletes, i.e. print only the header but not |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1431 | the diff between the preimage and <code>/dev/null</code>. The resulting patch |
| 1432 | is not meant to be applied with <code>patch</code> or <code>git apply</code>; this is |
Junio C Hamano | b02377c | 2011-04-28 22:26:02 | [diff] [blame] | 1433 | solely for people who want to just concentrate on reviewing the |
Junio C Hamano | d16fd1b | 2017-08-04 16:41:51 | [diff] [blame] | 1434 | text after the change. In addition, the output obviously lacks |
Junio C Hamano | b02377c | 2011-04-28 22:26:02 | [diff] [blame] | 1435 | enough information to apply such a patch in reverse, even manually, |
| 1436 | hence the name of the option. |
| 1437 | </p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1438 | <div class="paragraph"><p>When used together with <code>-B</code>, omit also the preimage in the deletion part |
Junio C Hamano | b02377c | 2011-04-28 22:26:02 | [diff] [blame] | 1439 | of a delete/create pair.</p></div> |
| 1440 | </dd> |
| 1441 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1442 | -l<num> |
| 1443 | </dt> |
| 1444 | <dd> |
| 1445 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1446 | The <code>-M</code> and <code>-C</code> options require O(n^2) processing time where n |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1447 | is the number of potential rename/copy targets. This |
| 1448 | option prevents rename/copy detection from running if |
| 1449 | the number of rename/copy targets exceeds the specified |
| 1450 | number. |
| 1451 | </p> |
| 1452 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1453 | <dt class="hdlist1"> |
Junio C Hamano | 982eb11 | 2010-11-18 00:53:09 | [diff] [blame] | 1454 | --diff-filter=[(A|C|D|M|R|T|U|X|B)…[*]] |
| 1455 | </dt> |
| 1456 | <dd> |
| 1457 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1458 | Select only files that are Added (<code>A</code>), Copied (<code>C</code>), |
| 1459 | Deleted (<code>D</code>), Modified (<code>M</code>), Renamed (<code>R</code>), have their |
| 1460 | type (i.e. regular file, symlink, submodule, …) changed (<code>T</code>), |
| 1461 | are Unmerged (<code>U</code>), are |
| 1462 | Unknown (<code>X</code>), or have had their pairing Broken (<code>B</code>). |
Junio C Hamano | 982eb11 | 2010-11-18 00:53:09 | [diff] [blame] | 1463 | Any combination of the filter characters (including none) can be used. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1464 | When <code>*</code> (All-or-none) is added to the combination, all |
Junio C Hamano | 982eb11 | 2010-11-18 00:53:09 | [diff] [blame] | 1465 | paths are selected if there is any file that matches |
| 1466 | other criteria in the comparison; if there is no file |
| 1467 | that matches other criteria, nothing is selected. |
| 1468 | </p> |
Junio C Hamano | eed15af | 2016-07-25 22:49:42 | [diff] [blame] | 1469 | <div class="paragraph"><p>Also, these upper-case letters can be downcased to exclude. E.g. |
| 1470 | <code>--diff-filter=ad</code> excludes added and deleted paths.</p></div> |
Junio C Hamano | 982eb11 | 2010-11-18 00:53:09 | [diff] [blame] | 1471 | </dd> |
| 1472 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1473 | -S<string> |
| 1474 | </dt> |
| 1475 | <dd> |
| 1476 | <p> |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1477 | Look for differences that change the number of occurrences of |
| 1478 | the specified string (i.e. addition/deletion) in a file. |
| 1479 | Intended for the scripter’s use. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1480 | </p> |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1481 | <div class="paragraph"><p>It is useful when you’re looking for an exact block of code (like a |
| 1482 | struct), and want to know the history of that block since it first |
| 1483 | came into being: use the feature iteratively to feed the interesting |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1484 | block in the preimage back into <code>-S</code>, and keep going until you get the |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1485 | very first version of the block.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1486 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1487 | <dt class="hdlist1"> |
Junio C Hamano | 3b4609d | 2010-09-30 00:04:34 | [diff] [blame] | 1488 | -G<regex> |
| 1489 | </dt> |
| 1490 | <dd> |
| 1491 | <p> |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1492 | Look for differences whose patch text contains added/removed |
| 1493 | lines that match <regex>. |
Junio C Hamano | 3b4609d | 2010-09-30 00:04:34 | [diff] [blame] | 1494 | </p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1495 | <div class="paragraph"><p>To illustrate the difference between <code>-S<regex> --pickaxe-regex</code> and |
| 1496 | <code>-G<regex></code>, consider a commit with the following diff in the same |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1497 | file:</p></div> |
| 1498 | <div class="listingblock"> |
| 1499 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1500 | <pre><code>+ return !regexec(regexp, two->ptr, 1, &regmatch, 0); |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1501 | ... |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1502 | - hit = !regexec(regexp, mf2.ptr, 1, &regmatch, 0);</code></pre> |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1503 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1504 | <div class="paragraph"><p>While <code>git log -G"regexec\(regexp"</code> will show this commit, <code>git log |
| 1505 | -S"regexec\(regexp" --pickaxe-regex</code> will not (because the number of |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1506 | occurrences of that string did not change).</p></div> |
| 1507 | <div class="paragraph"><p>See the <em>pickaxe</em> entry in <a href="gitdiffcore.html">gitdiffcore(7)</a> for more |
| 1508 | information.</p></div> |
Junio C Hamano | 3b4609d | 2010-09-30 00:04:34 | [diff] [blame] | 1509 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1510 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1511 | --pickaxe-all |
| 1512 | </dt> |
| 1513 | <dd> |
| 1514 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1515 | When <code>-S</code> or <code>-G</code> finds a change, show all the changes in that |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1516 | changeset, not just the files that contain the change |
| 1517 | in <string>. |
| 1518 | </p> |
| 1519 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1520 | <dt class="hdlist1"> |
Junio C Hamano | bfe9e75 | 2006-04-05 21:43:28 | [diff] [blame] | 1521 | --pickaxe-regex |
| 1522 | </dt> |
| 1523 | <dd> |
| 1524 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1525 | Treat the <string> given to <code>-S</code> as an extended POSIX regular |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1526 | expression to match. |
Junio C Hamano | bfe9e75 | 2006-04-05 21:43:28 | [diff] [blame] | 1527 | </p> |
| 1528 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1529 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1530 | -O<orderfile> |
| 1531 | </dt> |
| 1532 | <dd> |
| 1533 | <p> |
Junio C Hamano | bcd98f4 | 2017-01-24 00:12:16 | [diff] [blame] | 1534 | Control the order in which files appear in the output. |
Junio C Hamano | 322c624 | 2015-03-23 21:32:46 | [diff] [blame] | 1535 | This overrides the <code>diff.orderFile</code> configuration variable |
| 1536 | (see <a href="git-config.html">git-config(1)</a>). To cancel <code>diff.orderFile</code>, |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1537 | use <code>-O/dev/null</code>. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1538 | </p> |
Junio C Hamano | bcd98f4 | 2017-01-24 00:12:16 | [diff] [blame] | 1539 | <div class="paragraph"><p>The output order is determined by the order of glob patterns in |
| 1540 | <orderfile>. |
| 1541 | All files with pathnames that match the first pattern are output |
| 1542 | first, all files with pathnames that match the second pattern (but not |
| 1543 | the first) are output next, and so on. |
| 1544 | All files with pathnames that do not match any pattern are output |
| 1545 | last, as if there was an implicit match-all pattern at the end of the |
| 1546 | file. |
| 1547 | If multiple pathnames have the same rank (they match the same pattern |
| 1548 | but no earlier patterns), their output order relative to each other is |
| 1549 | the normal order.</p></div> |
| 1550 | <div class="paragraph"><p><orderfile> is parsed as follows:</p></div> |
| 1551 | <div class="openblock"> |
| 1552 | <div class="content"> |
| 1553 | <div class="ulist"><ul> |
| 1554 | <li> |
| 1555 | <p> |
| 1556 | Blank lines are ignored, so they can be used as separators for |
| 1557 | readability. |
| 1558 | </p> |
| 1559 | </li> |
| 1560 | <li> |
| 1561 | <p> |
| 1562 | Lines starting with a hash ("<code>#</code>") are ignored, so they can be used |
| 1563 | for comments. Add a backslash ("<code>\</code>") to the beginning of the |
| 1564 | pattern if it starts with a hash. |
| 1565 | </p> |
| 1566 | </li> |
| 1567 | <li> |
| 1568 | <p> |
| 1569 | Each other line contains a single pattern. |
| 1570 | </p> |
| 1571 | </li> |
| 1572 | </ul></div> |
| 1573 | </div></div> |
| 1574 | <div class="paragraph"><p>Patterns have the same syntax and semantics as patterns used for |
| 1575 | fnmantch(3) without the FNM_PATHNAME flag, except a pathname also |
| 1576 | matches a pattern if removing any number of the final pathname |
| 1577 | components matches the pattern. For example, the pattern "<code>foo*bar</code>" |
| 1578 | matches "<code>fooasdfbar</code>" and "<code>foo/bar/baz/asdf</code>" but not "<code>foobarx</code>".</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1579 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1580 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1581 | -R |
| 1582 | </dt> |
| 1583 | <dd> |
| 1584 | <p> |
| 1585 | Swap two inputs; that is, show differences from index or |
| 1586 | on-disk file to tree contents. |
| 1587 | </p> |
| 1588 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1589 | <dt class="hdlist1"> |
Junio C Hamano | 24bc09a | 2008-02-28 00:27:44 | [diff] [blame] | 1590 | --relative[=<path>] |
| 1591 | </dt> |
| 1592 | <dd> |
| 1593 | <p> |
| 1594 | When run from a subdirectory of the project, it can be |
| 1595 | told to exclude changes outside the directory and show |
| 1596 | pathnames relative to it with this option. When you are |
| 1597 | not in a subdirectory (e.g. in a bare repository), you |
| 1598 | can name which subdirectory to make the output relative |
| 1599 | to by giving a <path> as an argument. |
| 1600 | </p> |
| 1601 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1602 | <dt class="hdlist1"> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 1603 | -a |
| 1604 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1605 | <dt class="hdlist1"> |
Junio C Hamano | c26f548 | 2006-07-09 09:38:14 | [diff] [blame] | 1606 | --text |
| 1607 | </dt> |
| 1608 | <dd> |
| 1609 | <p> |
| 1610 | Treat all files as text. |
| 1611 | </p> |
| 1612 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1613 | <dt class="hdlist1"> |
Junio C Hamano | fd46896 | 2007-02-14 23:45:04 | [diff] [blame] | 1614 | --ignore-space-at-eol |
| 1615 | </dt> |
| 1616 | <dd> |
| 1617 | <p> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 1618 | Ignore changes in whitespace at EOL. |
Junio C Hamano | fd46896 | 2007-02-14 23:45:04 | [diff] [blame] | 1619 | </p> |
| 1620 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1621 | <dt class="hdlist1"> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 1622 | -b |
| 1623 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1624 | <dt class="hdlist1"> |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 1625 | --ignore-space-change |
| 1626 | </dt> |
| 1627 | <dd> |
| 1628 | <p> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 1629 | Ignore changes in amount of whitespace. This ignores whitespace |
| 1630 | at line end, and considers all other sequences of one or |
| 1631 | more whitespace characters to be equivalent. |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 1632 | </p> |
| 1633 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1634 | <dt class="hdlist1"> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 1635 | -w |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 1636 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1637 | <dt class="hdlist1"> |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 1638 | --ignore-all-space |
| 1639 | </dt> |
| 1640 | <dd> |
| 1641 | <p> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 1642 | Ignore whitespace when comparing lines. This ignores |
| 1643 | differences even if one line has whitespace where the other |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 1644 | line has none. |
| 1645 | </p> |
| 1646 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1647 | <dt class="hdlist1"> |
Junio C Hamano | a195230 | 2013-07-01 21:31:18 | [diff] [blame] | 1648 | --ignore-blank-lines |
| 1649 | </dt> |
| 1650 | <dd> |
| 1651 | <p> |
| 1652 | Ignore changes whose lines are all blank. |
| 1653 | </p> |
| 1654 | </dd> |
| 1655 | <dt class="hdlist1"> |
Junio C Hamano | 1d40ee8 | 2009-01-07 10:14:16 | [diff] [blame] | 1656 | --inter-hunk-context=<lines> |
| 1657 | </dt> |
| 1658 | <dd> |
| 1659 | <p> |
| 1660 | Show the context between diff hunks, up to the specified number |
| 1661 | of lines, thereby fusing hunks that are close to each other. |
Junio C Hamano | bcd98f4 | 2017-01-24 00:12:16 | [diff] [blame] | 1662 | Defaults to <code>diff.interHunkContext</code> or 0 if the config option |
| 1663 | is unset. |
Junio C Hamano | 1d40ee8 | 2009-01-07 10:14:16 | [diff] [blame] | 1664 | </p> |
| 1665 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1666 | <dt class="hdlist1"> |
Junio C Hamano | 11821ed | 2011-10-19 18:42:09 | [diff] [blame] | 1667 | -W |
| 1668 | </dt> |
| 1669 | <dt class="hdlist1"> |
| 1670 | --function-context |
| 1671 | </dt> |
| 1672 | <dd> |
| 1673 | <p> |
| 1674 | Show whole surrounding functions of changes. |
| 1675 | </p> |
| 1676 | </dd> |
| 1677 | <dt class="hdlist1"> |
Junio C Hamano | 48fd2f6 | 2007-03-19 02:02:30 | [diff] [blame] | 1678 | --exit-code |
| 1679 | </dt> |
| 1680 | <dd> |
| 1681 | <p> |
| 1682 | Make the program exit with codes similar to diff(1). |
| 1683 | That is, it exits with 1 if there were differences and |
| 1684 | 0 means no differences. |
| 1685 | </p> |
| 1686 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1687 | <dt class="hdlist1"> |
Junio C Hamano | 35e5755 | 2007-03-25 07:54:35 | [diff] [blame] | 1688 | --quiet |
| 1689 | </dt> |
| 1690 | <dd> |
| 1691 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1692 | Disable all output of the program. Implies <code>--exit-code</code>. |
Junio C Hamano | 35e5755 | 2007-03-25 07:54:35 | [diff] [blame] | 1693 | </p> |
| 1694 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1695 | <dt class="hdlist1"> |
Junio C Hamano | bb0f404 | 2007-07-04 06:41:40 | [diff] [blame] | 1696 | --ext-diff |
| 1697 | </dt> |
| 1698 | <dd> |
| 1699 | <p> |
| 1700 | Allow an external diff helper to be executed. If you set an |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1701 | external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need |
| 1702 | to use this option with <a href="git-log.html">git-log(1)</a> and friends. |
Junio C Hamano | bb0f404 | 2007-07-04 06:41:40 | [diff] [blame] | 1703 | </p> |
| 1704 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1705 | <dt class="hdlist1"> |
Junio C Hamano | bb0f404 | 2007-07-04 06:41:40 | [diff] [blame] | 1706 | --no-ext-diff |
| 1707 | </dt> |
| 1708 | <dd> |
| 1709 | <p> |
| 1710 | Disallow external diff drivers. |
| 1711 | </p> |
| 1712 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1713 | <dt class="hdlist1"> |
Junio C Hamano | c652aed | 2011-07-07 01:14:31 | [diff] [blame] | 1714 | --textconv |
| 1715 | </dt> |
| 1716 | <dt class="hdlist1"> |
| 1717 | --no-textconv |
| 1718 | </dt> |
| 1719 | <dd> |
| 1720 | <p> |
| 1721 | Allow (or disallow) external text conversion filters to be run |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1722 | when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for |
Junio C Hamano | c652aed | 2011-07-07 01:14:31 | [diff] [blame] | 1723 | details. Because textconv filters are typically a one-way |
| 1724 | conversion, the resulting diff is suitable for human |
| 1725 | consumption, but cannot be applied. For this reason, textconv |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1726 | filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and |
| 1727 | <a href="git-log.html">git-log(1)</a>, but not for <a href="git-format-patch.html">git-format-patch(1)</a> or |
Junio C Hamano | c652aed | 2011-07-07 01:14:31 | [diff] [blame] | 1728 | diff plumbing commands. |
| 1729 | </p> |
| 1730 | </dd> |
| 1731 | <dt class="hdlist1"> |
Junio C Hamano | 7d44952 | 2010-07-01 00:08:51 | [diff] [blame] | 1732 | --ignore-submodules[=<when>] |
Junio C Hamano | dfccbb0 | 2008-05-26 01:16:14 | [diff] [blame] | 1733 | </dt> |
| 1734 | <dd> |
| 1735 | <p> |
Junio C Hamano | 7d44952 | 2010-07-01 00:08:51 | [diff] [blame] | 1736 | Ignore changes to submodules in the diff generation. <when> can be |
Junio C Hamano | c710296 | 2013-05-29 23:57:17 | [diff] [blame] | 1737 | either "none", "untracked", "dirty" or "all", which is the default. |
Junio C Hamano | 619596a | 2010-08-18 22:15:35 | [diff] [blame] | 1738 | Using "none" will consider the submodule modified when it either contains |
| 1739 | untracked or modified files or its HEAD differs from the commit recorded |
| 1740 | in the superproject and can be used to override any settings of the |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1741 | <em>ignore</em> option in <a href="git-config.html">git-config(1)</a> or <a href="gitmodules.html">gitmodules(5)</a>. When |
Junio C Hamano | 7d44952 | 2010-07-01 00:08:51 | [diff] [blame] | 1742 | "untracked" is used submodules are not considered dirty when they only |
| 1743 | contain untracked content (but they are still scanned for modified |
| 1744 | content). Using "dirty" ignores all changes to the work tree of submodules, |
| 1745 | only changes to the commits stored in the superproject are shown (this was |
| 1746 | the behavior until 1.7.0). Using "all" hides all changes to submodules. |
Junio C Hamano | dfccbb0 | 2008-05-26 01:16:14 | [diff] [blame] | 1747 | </p> |
| 1748 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1749 | <dt class="hdlist1"> |
Junio C Hamano | e27cbd2 | 2007-12-21 17:57:33 | [diff] [blame] | 1750 | --src-prefix=<prefix> |
| 1751 | </dt> |
| 1752 | <dd> |
| 1753 | <p> |
| 1754 | Show the given source prefix instead of "a/". |
| 1755 | </p> |
| 1756 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1757 | <dt class="hdlist1"> |
Junio C Hamano | e27cbd2 | 2007-12-21 17:57:33 | [diff] [blame] | 1758 | --dst-prefix=<prefix> |
| 1759 | </dt> |
| 1760 | <dd> |
| 1761 | <p> |
| 1762 | Show the given destination prefix instead of "b/". |
| 1763 | </p> |
| 1764 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1765 | <dt class="hdlist1"> |
Junio C Hamano | e27cbd2 | 2007-12-21 17:57:33 | [diff] [blame] | 1766 | --no-prefix |
| 1767 | </dt> |
| 1768 | <dd> |
| 1769 | <p> |
| 1770 | Do not show any source or destination prefix. |
| 1771 | </p> |
| 1772 | </dd> |
Junio C Hamano | cd45166 | 2016-09-13 00:54:09 | [diff] [blame] | 1773 | <dt class="hdlist1"> |
| 1774 | --line-prefix=<prefix> |
| 1775 | </dt> |
| 1776 | <dd> |
| 1777 | <p> |
| 1778 | Prepend an additional prefix to every line of output. |
| 1779 | </p> |
| 1780 | </dd> |
Junio C Hamano | f7017f1 | 2016-10-27 23:31:34 | [diff] [blame] | 1781 | <dt class="hdlist1"> |
| 1782 | --ita-invisible-in-index |
| 1783 | </dt> |
| 1784 | <dd> |
| 1785 | <p> |
| 1786 | By default entries added by "git add -N" appear as an existing |
| 1787 | empty file in "git diff" and a new file in "git diff --cached". |
| 1788 | This option makes the entry appear as a new file in "git diff" |
| 1789 | and non-existent in "git diff --cached". This option could be |
| 1790 | reverted with <code>--ita-visible-in-index</code>. Both options are |
| 1791 | experimental and could be removed in future. |
| 1792 | </p> |
| 1793 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1794 | </dl></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1795 | <div class="paragraph"><p>For more detailed explanation on these common options, see also |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1796 | <a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1797 | <div class="dlist"><dl> |
| 1798 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1799 | <tree-ish> |
| 1800 | </dt> |
| 1801 | <dd> |
| 1802 | <p> |
| 1803 | The id of a tree object to diff against. |
| 1804 | </p> |
| 1805 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1806 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1807 | --cached |
| 1808 | </dt> |
| 1809 | <dd> |
| 1810 | <p> |
| 1811 | do not consider the on-disk file at all |
| 1812 | </p> |
| 1813 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1814 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1815 | -m |
| 1816 | </dt> |
| 1817 | <dd> |
| 1818 | <p> |
| 1819 | By default, files recorded in the index but not checked |
| 1820 | out are reported as deleted. This flag makes |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1821 | <em>git diff-index</em> say that all non-checked-out files are up |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1822 | to date. |
| 1823 | </p> |
| 1824 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1825 | </dl></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1826 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 1827 | </div> |
| 1828 | <div class="sect1"> |
Junio C Hamano | 543f8d6 | 2009-07-29 08:35:21 | [diff] [blame] | 1829 | <h2 id="_raw_output_format">Raw output format</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1830 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1831 | <div class="paragraph"><p>The raw output format from "git-diff-index", "git-diff-tree", |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1832 | "git-diff-files" and "git diff --raw" are very similar.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1833 | <div class="paragraph"><p>These commands all compare two sets of things; what is |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1834 | compared differs:</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1835 | <div class="dlist"><dl> |
| 1836 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1837 | git-diff-index <tree-ish> |
| 1838 | </dt> |
| 1839 | <dd> |
| 1840 | <p> |
| 1841 | compares the <tree-ish> and the files on the filesystem. |
| 1842 | </p> |
| 1843 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1844 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1845 | git-diff-index --cached <tree-ish> |
| 1846 | </dt> |
| 1847 | <dd> |
| 1848 | <p> |
| 1849 | compares the <tree-ish> and the index. |
| 1850 | </p> |
| 1851 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1852 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1853 | git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>…] |
| 1854 | </dt> |
| 1855 | <dd> |
| 1856 | <p> |
| 1857 | compares the trees named by the two arguments. |
| 1858 | </p> |
| 1859 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1860 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1861 | git-diff-files [<pattern>…] |
| 1862 | </dt> |
| 1863 | <dd> |
| 1864 | <p> |
| 1865 | compares the index and the files on the filesystem. |
| 1866 | </p> |
| 1867 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1868 | </dl></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1869 | <div class="paragraph"><p>The "git-diff-tree" command begins its output by printing the hash of |
Junio C Hamano | 543f8d6 | 2009-07-29 08:35:21 | [diff] [blame] | 1870 | what is being compared. After that, all the commands print one output |
| 1871 | line per changed file.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1872 | <div class="paragraph"><p>An output line is formatted this way:</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1873 | <div class="listingblock"> |
| 1874 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1875 | <pre><code>in-place edit :100644 100644 bcd1234... 0123456... M file0 |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1876 | copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2 |
| 1877 | rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3 |
| 1878 | create :000000 100644 0000000... 1234567... A file4 |
| 1879 | delete :100644 000000 1234567... 0000000... D file5 |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1880 | unmerged :000000 000000 0000000... 0000000... U file6</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1881 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1882 | <div class="paragraph"><p>That is, from the left to the right:</p></div> |
| 1883 | <div class="olist arabic"><ol class="arabic"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1884 | <li> |
| 1885 | <p> |
| 1886 | a colon. |
| 1887 | </p> |
| 1888 | </li> |
| 1889 | <li> |
| 1890 | <p> |
| 1891 | mode for "src"; 000000 if creation or unmerged. |
| 1892 | </p> |
| 1893 | </li> |
| 1894 | <li> |
| 1895 | <p> |
| 1896 | a space. |
| 1897 | </p> |
| 1898 | </li> |
| 1899 | <li> |
| 1900 | <p> |
| 1901 | mode for "dst"; 000000 if deletion or unmerged. |
| 1902 | </p> |
| 1903 | </li> |
| 1904 | <li> |
| 1905 | <p> |
| 1906 | a space. |
| 1907 | </p> |
| 1908 | </li> |
| 1909 | <li> |
| 1910 | <p> |
| 1911 | sha1 for "src"; 0{40} if creation or unmerged. |
| 1912 | </p> |
| 1913 | </li> |
| 1914 | <li> |
| 1915 | <p> |
| 1916 | a space. |
| 1917 | </p> |
| 1918 | </li> |
| 1919 | <li> |
| 1920 | <p> |
| 1921 | sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree". |
| 1922 | </p> |
| 1923 | </li> |
| 1924 | <li> |
| 1925 | <p> |
| 1926 | a space. |
| 1927 | </p> |
| 1928 | </li> |
| 1929 | <li> |
| 1930 | <p> |
| 1931 | status, followed by optional "score" number. |
| 1932 | </p> |
| 1933 | </li> |
| 1934 | <li> |
| 1935 | <p> |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 1936 | a tab or a NUL when <code>-z</code> option is used. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1937 | </p> |
| 1938 | </li> |
| 1939 | <li> |
| 1940 | <p> |
| 1941 | path for "src" |
| 1942 | </p> |
| 1943 | </li> |
| 1944 | <li> |
| 1945 | <p> |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 1946 | a tab or a NUL when <code>-z</code> option is used; only exists for C or R. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1947 | </p> |
| 1948 | </li> |
| 1949 | <li> |
| 1950 | <p> |
| 1951 | path for "dst"; only exists for C or R. |
| 1952 | </p> |
| 1953 | </li> |
| 1954 | <li> |
| 1955 | <p> |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 1956 | an LF or a NUL when <code>-z</code> option is used, to terminate the record. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1957 | </p> |
| 1958 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1959 | </ol></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1960 | <div class="paragraph"><p>Possible status letters are:</p></div> |
| 1961 | <div class="ulist"><ul> |
Junio C Hamano | aa17c7c | 2008-11-03 04:36:58 | [diff] [blame] | 1962 | <li> |
| 1963 | <p> |
| 1964 | A: addition of a file |
| 1965 | </p> |
| 1966 | </li> |
| 1967 | <li> |
| 1968 | <p> |
| 1969 | C: copy of a file into a new one |
| 1970 | </p> |
| 1971 | </li> |
| 1972 | <li> |
| 1973 | <p> |
| 1974 | D: deletion of a file |
| 1975 | </p> |
| 1976 | </li> |
| 1977 | <li> |
| 1978 | <p> |
| 1979 | M: modification of the contents or mode of a file |
| 1980 | </p> |
| 1981 | </li> |
| 1982 | <li> |
| 1983 | <p> |
| 1984 | R: renaming of a file |
| 1985 | </p> |
| 1986 | </li> |
| 1987 | <li> |
| 1988 | <p> |
| 1989 | T: change in the type of the file |
| 1990 | </p> |
| 1991 | </li> |
| 1992 | <li> |
| 1993 | <p> |
| 1994 | U: file is unmerged (you must complete the merge before it can |
| 1995 | be committed) |
| 1996 | </p> |
| 1997 | </li> |
| 1998 | <li> |
| 1999 | <p> |
| 2000 | X: "unknown" change type (most probably a bug, please report it) |
| 2001 | </p> |
| 2002 | </li> |
| 2003 | </ul></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2004 | <div class="paragraph"><p>Status letters C and R are always followed by a score (denoting the |
Junio C Hamano | aa17c7c | 2008-11-03 04:36:58 | [diff] [blame] | 2005 | percentage of similarity between the source and target of the move or |
Junio C Hamano | 6bb32e6 | 2015-02-17 22:11:26 | [diff] [blame] | 2006 | copy). Status letter M may be followed by a score (denoting the |
| 2007 | percentage of dissimilarity) for file rewrites.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2008 | <div class="paragraph"><p><sha1> is shown as all 0’s if a file is new on the filesystem |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2009 | and it is out of sync with the index.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2010 | <div class="paragraph"><p>Example:</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2011 | <div class="listingblock"> |
| 2012 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2013 | <pre><code>:100644 100644 5be4a4...... 000000...... M file.c</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2014 | </div></div> |
Junio C Hamano | 0f6f3bf | 2017-03-13 07:01:53 | [diff] [blame] | 2015 | <div class="paragraph"><p>Without the <code>-z</code> option, pathnames with "unusual" characters are |
| 2016 | quoted as explained for the configuration variable <code>core.quotePath</code> |
| 2017 | (see <a href="git-config.html">git-config(1)</a>). Using <code>-z</code> the filename is output |
| 2018 | verbatim and the line is terminated by a NUL byte.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2019 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2020 | </div> |
| 2021 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2022 | <h2 id="_diff_format_for_merges">diff format for merges</h2> |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 2023 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2024 | <div class="paragraph"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw" |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 2025 | can take <code>-c</code> or <code>--cc</code> option |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 2026 | to generate diff output also for merge commits. The output differs |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2027 | from the format described above in the following way:</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2028 | <div class="olist arabic"><ol class="arabic"> |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 2029 | <li> |
| 2030 | <p> |
| 2031 | there is a colon for each parent |
| 2032 | </p> |
| 2033 | </li> |
| 2034 | <li> |
| 2035 | <p> |
| 2036 | there are more "src" modes and "src" sha1 |
| 2037 | </p> |
| 2038 | </li> |
| 2039 | <li> |
| 2040 | <p> |
| 2041 | status is concatenated status characters for each parent |
| 2042 | </p> |
| 2043 | </li> |
| 2044 | <li> |
| 2045 | <p> |
| 2046 | no optional "score" number |
| 2047 | </p> |
| 2048 | </li> |
| 2049 | <li> |
| 2050 | <p> |
| 2051 | single path, only for "dst" |
| 2052 | </p> |
| 2053 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2054 | </ol></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2055 | <div class="paragraph"><p>Example:</p></div> |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 2056 | <div class="listingblock"> |
| 2057 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2058 | <pre><code>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</code></pre> |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 2059 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2060 | <div class="paragraph"><p>Note that <em>combined diff</em> lists only files which were modified from |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2061 | all parents.</p></div> |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 2062 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2063 | </div> |
| 2064 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2065 | <h2 id="_generating_patches_with_p">Generating patches with -p</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2066 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2067 | <div class="paragraph"><p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 2068 | with a <code>-p</code> option, "git diff" without the <code>--raw</code> option, or |
Junio C Hamano | 00b8b63 | 2007-12-07 09:50:49 | [diff] [blame] | 2069 | "git log" with the "-p" option, they |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 2070 | do not produce the output described above; instead they produce a |
| 2071 | patch file. You can customize the creation of such patches via the |
Junio C Hamano | 042f214 | 2016-06-27 18:05:05 | [diff] [blame] | 2072 | <code>GIT_EXTERNAL_DIFF</code> and the <code>GIT_DIFF_OPTS</code> environment variables.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2073 | <div class="paragraph"><p>What the -p option produces is slightly different from the traditional |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2074 | diff format:</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2075 | <div class="olist arabic"><ol class="arabic"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2076 | <li> |
| 2077 | <p> |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2078 | It is preceded with a "git diff" header that looks like this: |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2079 | </p> |
| 2080 | <div class="literalblock"> |
| 2081 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2082 | <pre><code>diff --git a/file1 b/file2</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2083 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2084 | <div class="paragraph"><p>The <code>a/</code> and <code>b/</code> filenames are the same unless rename/copy is |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2085 | involved. Especially, even for a creation or a deletion, |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2086 | <code>/dev/null</code> is <em>not</em> used in place of the <code>a/</code> or <code>b/</code> filenames.</p></div> |
| 2087 | <div class="paragraph"><p>When rename/copy is involved, <code>file1</code> and <code>file2</code> show the |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2088 | name of the source file of the rename/copy and the name of |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2089 | the file that rename/copy produces, respectively.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2090 | </li> |
| 2091 | <li> |
| 2092 | <p> |
| 2093 | It is followed by one or more extended header lines: |
| 2094 | </p> |
| 2095 | <div class="literalblock"> |
| 2096 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2097 | <pre><code>old mode <mode> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2098 | new mode <mode> |
| 2099 | deleted file mode <mode> |
| 2100 | new file mode <mode> |
| 2101 | copy from <path> |
| 2102 | copy to <path> |
| 2103 | rename from <path> |
| 2104 | rename to <path> |
| 2105 | similarity index <number> |
| 2106 | dissimilarity index <number> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2107 | index <hash>..<hash> <mode></code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2108 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2109 | <div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2110 | and file permission bits.</p></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2111 | <div class="paragraph"><p>Path names in extended headers do not include the <code>a/</code> and <code>b/</code> prefixes.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2112 | <div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2113 | the dissimilarity index is the percentage of changed lines. It |
| 2114 | is a rounded down integer, followed by a percent sign. The |
| 2115 | similarity index value of 100% is thus reserved for two equal |
| 2116 | files, while 100% dissimilarity means that no line from the old |
| 2117 | file made it into the new one.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2118 | <div class="paragraph"><p>The index line includes the SHA-1 checksum before and after the change. |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2119 | The <mode> is included if the file mode does not change; otherwise, |
| 2120 | separate lines indicate the old and the new mode.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2121 | </li> |
| 2122 | <li> |
| 2123 | <p> |
Junio C Hamano | 0f6f3bf | 2017-03-13 07:01:53 | [diff] [blame] | 2124 | Pathnames with "unusual" characters are quoted as explained for |
| 2125 | the configuration variable <code>core.quotePath</code> (see |
| 2126 | <a href="git-config.html">git-config(1)</a>). |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2127 | </p> |
| 2128 | </li> |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2129 | <li> |
| 2130 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2131 | All the <code>file1</code> files in the output refer to files before the |
| 2132 | commit, and all the <code>file2</code> files refer to files after the commit. |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2133 | It is incorrect to apply each change to each file sequentially. For |
| 2134 | example, this patch will swap a and b: |
| 2135 | </p> |
| 2136 | <div class="literalblock"> |
| 2137 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2138 | <pre><code>diff --git a/a b/b |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2139 | rename from a |
| 2140 | rename to b |
| 2141 | diff --git a/b b/a |
| 2142 | rename from b |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2143 | rename to a</code></pre> |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2144 | </div></div> |
| 2145 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2146 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2147 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2148 | </div> |
| 2149 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2150 | <h2 id="_combined_diff_format">combined diff format</h2> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2151 | <div class="sectionbody"> |
Junio C Hamano | 1dbca52 | 2015-05-22 20:48:55 | [diff] [blame] | 2152 | <div class="paragraph"><p>Any diff-generating command can take the <code>-c</code> or <code>--cc</code> option to |
Junio C Hamano | c5be4cc | 2011-03-09 07:20:43 | [diff] [blame] | 2153 | produce a <em>combined diff</em> when showing a merge. This is the default |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 2154 | format when showing merges with <a href="git-diff.html">git-diff(1)</a> or |
Junio C Hamano | 1dbca52 | 2015-05-22 20:48:55 | [diff] [blame] | 2155 | <a href="git-show.html">git-show(1)</a>. Note also that you can give the <code>-m</code> option to any |
Junio C Hamano | c5be4cc | 2011-03-09 07:20:43 | [diff] [blame] | 2156 | of these commands to force generation of diffs with individual parents |
| 2157 | of a merge.</p></div> |
| 2158 | <div class="paragraph"><p>A <em>combined diff</em> format looks like this:</p></div> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2159 | <div class="listingblock"> |
| 2160 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2161 | <pre><code>diff --combined describe.c |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2162 | index fabadb8,cc95eb0..4866510 |
| 2163 | --- a/describe.c |
| 2164 | +++ b/describe.c |
| 2165 | @@@ -98,20 -98,12 +98,20 @@@ |
| 2166 | return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1; |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2167 | } |
| 2168 | |
| 2169 | - static void describe(char *arg) |
| 2170 | -static void describe(struct commit *cmit, int last_one) |
| 2171 | ++static void describe(char *arg, int last_one) |
| 2172 | { |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2173 | + unsigned char sha1[20]; |
| 2174 | + struct commit *cmit; |
| 2175 | struct commit_list *list; |
| 2176 | static int initialized = 0; |
| 2177 | struct commit_name *n; |
| 2178 | |
| 2179 | + if (get_sha1(arg, sha1) < 0) |
| 2180 | + usage(describe_usage); |
| 2181 | + cmit = lookup_commit_reference(sha1); |
| 2182 | + if (!cmit) |
| 2183 | + usage(describe_usage); |
| 2184 | + |
| 2185 | if (!initialized) { |
| 2186 | initialized = 1; |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2187 | for_each_ref(get_name);</code></pre> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2188 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2189 | <div class="olist arabic"><ol class="arabic"> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2190 | <li> |
| 2191 | <p> |
| 2192 | It is preceded with a "git diff" header, that looks like |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 2193 | this (when <code>-c</code> option is used): |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2194 | </p> |
| 2195 | <div class="literalblock"> |
| 2196 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2197 | <pre><code>diff --combined file</code></pre> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2198 | </div></div> |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 2199 | <div class="paragraph"><p>or like this (when <code>--cc</code> option is used):</p></div> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2200 | <div class="literalblock"> |
| 2201 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2202 | <pre><code>diff --cc file</code></pre> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2203 | </div></div> |
| 2204 | </li> |
| 2205 | <li> |
| 2206 | <p> |
| 2207 | It is followed by one or more extended header lines |
| 2208 | (this example shows a merge with two parents): |
| 2209 | </p> |
| 2210 | <div class="literalblock"> |
| 2211 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2212 | <pre><code>index <hash>,<hash>..<hash> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2213 | mode <mode>,<mode>..<mode> |
| 2214 | new file mode <mode> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2215 | deleted file mode <mode>,<mode></code></pre> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2216 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2217 | <div class="paragraph"><p>The <code>mode <mode>,<mode>..<mode></code> line appears only if at least one of |
Junio C Hamano | ee1e428 | 2007-02-04 08:32:04 | [diff] [blame] | 2218 | the <mode> is different from the rest. Extended headers with |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2219 | information about detected contents movement (renames and |
| 2220 | copying detection) are designed to work with diff of two |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2221 | <tree-ish> and are not used by combined diff format.</p></div> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2222 | </li> |
| 2223 | <li> |
| 2224 | <p> |
| 2225 | It is followed by two-line from-file/to-file header |
| 2226 | </p> |
| 2227 | <div class="literalblock"> |
| 2228 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2229 | <pre><code>--- a/file |
| 2230 | +++ b/file</code></pre> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2231 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2232 | <div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2233 | format, <code>/dev/null</code> is used to signal created or deleted |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2234 | files.</p></div> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2235 | </li> |
| 2236 | <li> |
| 2237 | <p> |
| 2238 | Chunk header format is modified to prevent people from |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2239 | accidentally feeding it to <code>patch -p1</code>. Combined diff format |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2240 | was created for review of merge commit changes, and was not |
| 2241 | meant for apply. The change is similar to the change in the |
| 2242 | extended <em>index</em> header: |
| 2243 | </p> |
| 2244 | <div class="literalblock"> |
| 2245 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2246 | <pre><code>@@@ <from-file-range> <from-file-range> <to-file-range> @@@</code></pre> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2247 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2248 | <div class="paragraph"><p>There are (number of parents + 1) <code>@</code> characters in the chunk |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2249 | header for combined diff format.</p></div> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2250 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2251 | </ol></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2252 | <div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2253 | 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 |
| 2254 | added to B), or <code>" "</code> (space — unchanged) prefix, this format |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2255 | compares two or more files file1, file2,… with one file X, and |
| 2256 | shows how X differs from each of fileN. One column for each of |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2257 | fileN is prepended to the output line to note how X’s line is |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2258 | different from it.</p></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2259 | <div class="paragraph"><p>A <code>-</code> character in the column N means that the line appears in |
| 2260 | fileN but it does not appear in the result. A <code>+</code> character |
Junio C Hamano | 54bf1e2 | 2008-12-20 06:30:11 | [diff] [blame] | 2261 | in the column N means that the line appears in the result, |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2262 | and fileN does not have that line (in other words, the line was |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2263 | added, from the point of view of that parent).</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2264 | <div class="paragraph"><p>In the above example output, the function signature was changed |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2265 | from both files (hence two <code>-</code> removals from both file1 and |
| 2266 | file2, plus <code>++</code> to mean one line that was added does not appear |
Junio C Hamano | d75148a | 2014-04-08 19:48:38 | [diff] [blame] | 2267 | in either file1 or file2). Also eight other lines are the same |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2268 | from file1 but do not appear in file2 (hence prefixed with <code>+</code>).</p></div> |
| 2269 | <div class="paragraph"><p>When shown by <code>git diff-tree -c</code>, it compares the parents of a |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2270 | merge commit with the merge result (i.e. file1..fileN are the |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2271 | parents). When shown by <code>git diff-files -c</code>, it compares the |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2272 | two unresolved merge parents with the working tree file |
| 2273 | (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2274 | "their version").</p></div> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2275 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2276 | </div> |
| 2277 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2278 | <h2 id="_other_diff_formats">other diff formats</h2> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2279 | <div class="sectionbody"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2280 | <div class="paragraph"><p>The <code>--summary</code> option describes newly added, deleted, renamed and |
| 2281 | copied files. The <code>--stat</code> option adds diffstat(1) graph to the |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2282 | output. These options can be combined with other options, such as |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2283 | <code>-p</code>, and are meant for human consumption.</p></div> |
| 2284 | <div class="paragraph"><p>When showing a change that involves a rename or a copy, <code>--stat</code> output |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2285 | formats the pathnames compactly by combining common prefix and suffix of |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2286 | the pathnames. For example, a change that moves <code>arch/i386/Makefile</code> to |
| 2287 | <code>arch/x86/Makefile</code> while modifying 4 lines will be shown like this:</p></div> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2288 | <div class="listingblock"> |
| 2289 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2290 | <pre><code>arch/{i386 => x86}/Makefile | 4 +--</code></pre> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2291 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2292 | <div class="paragraph"><p>The <code>--numstat</code> option gives the diffstat(1) information but is designed |
| 2293 | for easier machine consumption. An entry in <code>--numstat</code> output looks |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2294 | like this:</p></div> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2295 | <div class="listingblock"> |
| 2296 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2297 | <pre><code>1 2 README |
| 2298 | 3 1 arch/{i386 => x86}/Makefile</code></pre> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2299 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2300 | <div class="paragraph"><p>That is, from left to right:</p></div> |
| 2301 | <div class="olist arabic"><ol class="arabic"> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2302 | <li> |
| 2303 | <p> |
| 2304 | the number of added lines; |
| 2305 | </p> |
| 2306 | </li> |
| 2307 | <li> |
| 2308 | <p> |
| 2309 | a tab; |
| 2310 | </p> |
| 2311 | </li> |
| 2312 | <li> |
| 2313 | <p> |
| 2314 | the number of deleted lines; |
| 2315 | </p> |
| 2316 | </li> |
| 2317 | <li> |
| 2318 | <p> |
| 2319 | a tab; |
| 2320 | </p> |
| 2321 | </li> |
| 2322 | <li> |
| 2323 | <p> |
| 2324 | pathname (possibly with rename/copy information); |
| 2325 | </p> |
| 2326 | </li> |
| 2327 | <li> |
| 2328 | <p> |
| 2329 | a newline. |
| 2330 | </p> |
| 2331 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2332 | </ol></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2333 | <div class="paragraph"><p>When <code>-z</code> output option is in effect, the output is formatted this way:</p></div> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2334 | <div class="listingblock"> |
| 2335 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2336 | <pre><code>1 2 README NUL |
| 2337 | 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</code></pre> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2338 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2339 | <div class="paragraph"><p>That is:</p></div> |
| 2340 | <div class="olist arabic"><ol class="arabic"> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2341 | <li> |
| 2342 | <p> |
| 2343 | the number of added lines; |
| 2344 | </p> |
| 2345 | </li> |
| 2346 | <li> |
| 2347 | <p> |
| 2348 | a tab; |
| 2349 | </p> |
| 2350 | </li> |
| 2351 | <li> |
| 2352 | <p> |
| 2353 | the number of deleted lines; |
| 2354 | </p> |
| 2355 | </li> |
| 2356 | <li> |
| 2357 | <p> |
| 2358 | a tab; |
| 2359 | </p> |
| 2360 | </li> |
| 2361 | <li> |
| 2362 | <p> |
| 2363 | a NUL (only exists if renamed/copied); |
| 2364 | </p> |
| 2365 | </li> |
| 2366 | <li> |
| 2367 | <p> |
| 2368 | pathname in preimage; |
| 2369 | </p> |
| 2370 | </li> |
| 2371 | <li> |
| 2372 | <p> |
| 2373 | a NUL (only exists if renamed/copied); |
| 2374 | </p> |
| 2375 | </li> |
| 2376 | <li> |
| 2377 | <p> |
| 2378 | pathname in postimage (only exists if renamed/copied); |
| 2379 | </p> |
| 2380 | </li> |
| 2381 | <li> |
| 2382 | <p> |
| 2383 | a NUL. |
| 2384 | </p> |
| 2385 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2386 | </ol></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2387 | <div class="paragraph"><p>The extra <code>NUL</code> before the preimage path in renamed case is to allow |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2388 | scripts that read the output to tell if the current record being read is |
| 2389 | a single-path record or a rename/copy record without reading ahead. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2390 | After reading added and deleted lines, reading up to <code>NUL</code> would yield |
| 2391 | the pathname, but if that is <code>NUL</code>, the record will show two paths.</p></div> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2392 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2393 | </div> |
| 2394 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2395 | <h2 id="_operating_modes">Operating Modes</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2396 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2397 | <div class="paragraph"><p>You can choose whether you want to trust the index file entirely |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 2398 | (using the <code>--cached</code> flag) or ask the diff logic to show any files |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2399 | that don’t match the stat state as being "tentatively changed". Both |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2400 | of these operations are very useful indeed.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2401 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2402 | </div> |
| 2403 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2404 | <h2 id="_cached_mode">Cached Mode</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2405 | <div class="sectionbody"> |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 2406 | <div class="paragraph"><p>If <code>--cached</code> is specified, it allows you to ask:</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2407 | <div class="literalblock"> |
| 2408 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2409 | <pre><code>show me the differences between HEAD and the current index |
| 2410 | contents (the ones I'd write using 'git write-tree')</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2411 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2412 | <div class="paragraph"><p>For example, let’s say that you have worked on your working directory, updated |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 2413 | some files in the index and are ready to commit. You want to see exactly |
Junio C Hamano | dcc22ee | 2006-11-03 02:40:13 | [diff] [blame] | 2414 | <strong>what</strong> you are going to commit, without having to write a new tree |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2415 | object and compare it that way, and to do that, you just do</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2416 | <div class="literalblock"> |
| 2417 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2418 | <pre><code>git diff-index --cached HEAD</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2419 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2420 | <div class="paragraph"><p>Example: let’s say I had renamed <code>commit.c</code> to <code>git-commit.c</code>, and I had |
| 2421 | done an <code>update-index</code> to make that effective in the index file. |
| 2422 | <code>git diff-files</code> wouldn’t show anything at all, since the index file |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 2423 | matches my working directory. But doing a <em>git diff-index</em> does:</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2424 | <div class="literalblock"> |
| 2425 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2426 | <pre><code>torvalds@ppc970:~/git> git diff-index --cached HEAD |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2427 | -100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 commit.c |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2428 | +100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 git-commit.c</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2429 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2430 | <div class="paragraph"><p>You can see easily that the above is a rename.</p></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2431 | <div class="paragraph"><p>In fact, <code>git diff-index --cached</code> <strong>should</strong> always be entirely equivalent to |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 2432 | actually doing a <em>git write-tree</em> and comparing that. Except this one is much |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2433 | nicer for the case where you just want to check where you are.</p></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2434 | <div class="paragraph"><p>So doing a <code>git diff-index --cached</code> is basically very useful when you are |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2435 | asking yourself "what have I already marked for being committed, and |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2436 | what’s the difference to a previous tree".</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2437 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2438 | </div> |
| 2439 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2440 | <h2 id="_non_cached_mode">Non-cached Mode</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2441 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2442 | <div class="paragraph"><p>The "non-cached" mode takes a different approach, and is potentially |
| 2443 | the more useful of the two in that what it does can’t be emulated with |
| 2444 | a <em>git write-tree</em> + <em>git diff-tree</em>. Thus that’s the default mode. |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2445 | The non-cached version asks the question:</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2446 | <div class="literalblock"> |
| 2447 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2448 | <pre><code>show me the differences between HEAD and the currently checked out |
Junio C Hamano | 88bf571 | 2017-09-10 08:39:23 | [diff] [blame^] | 2449 | tree - index contents _and_ files that aren't up to date</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2450 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2451 | <div class="paragraph"><p>which is obviously a very useful question too, since that tells you what |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 2452 | you <strong>could</strong> commit. Again, the output matches the <em>git diff-tree -r</em> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2453 | output to a tee, but with a twist.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2454 | <div class="paragraph"><p>The twist is that if some file doesn’t match the index, we don’t have |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2455 | a backing store thing for it, and we use the magic "all-zero" sha1 to |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2456 | show that. So let’s say that you have edited <code>kernel/sched.c</code>, but |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 2457 | have not actually done a <em>git update-index</em> on it yet - there is no |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2458 | "object" associated with the new state, and you get:</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2459 | <div class="literalblock"> |
| 2460 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2461 | <pre><code>torvalds@ppc970:~/v2.6/linux> git diff-index --abbrev HEAD |
| 2462 | :100644 100664 7476bb... 000000... kernel/sched.c</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2463 | </div></div> |
Junio C Hamano | 88bf571 | 2017-09-10 08:39:23 | [diff] [blame^] | 2464 | <div class="paragraph"><p>i.e., it shows that the tree has changed, and that <code>kernel/sched.c</code> is |
| 2465 | not up to date and may contain new stuff. The all-zero sha1 means that to |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2466 | get the real diff, you need to look at the object in the working directory |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2467 | directly rather than do an object-to-object diff.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2468 | <div class="admonitionblock"> |
| 2469 | <table><tr> |
| 2470 | <td class="icon"> |
| 2471 | <div class="title">Note</div> |
| 2472 | </td> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 2473 | <td class="content">As with other commands of this type, <em>git diff-index</em> does not |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2474 | actually look at the contents of the file at all. So maybe |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2475 | <code>kernel/sched.c</code> hasn’t actually changed, and it’s just that you |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2476 | touched it. In either case, it’s a note that you need to |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 2477 | <em>git update-index</em> it to make the index be in sync.</td> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2478 | </tr></table> |
| 2479 | </div> |
| 2480 | <div class="admonitionblock"> |
| 2481 | <table><tr> |
| 2482 | <td class="icon"> |
| 2483 | <div class="title">Note</div> |
| 2484 | </td> |
| 2485 | <td class="content">You can have a mixture of files show up as "has been updated" |
| 2486 | and "is still dirty in the working directory" together. You can always |
| 2487 | tell which file is in which state, since the "has been updated" ones |
| 2488 | show a valid sha1, and the "not in sync with the index" ones will |
| 2489 | always have the special all-zero sha1.</td> |
| 2490 | </tr></table> |
| 2491 | </div> |
| 2492 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2493 | </div> |
| 2494 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2495 | <h2 id="_git">GIT</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2496 | <div class="sectionbody"> |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 2497 | <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2498 | </div> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 2499 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2500 | </div> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 2501 | <div id="footnotes"><hr /></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2502 | <div id="footer"> |
| 2503 | <div id="footer-text"> |
Junio C Hamano | 88bf571 | 2017-09-10 08:39:23 | [diff] [blame^] | 2504 | Last updated 2017-09-10 17:38:46 JST |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2505 | </div> |
| 2506 | </div> |
| 2507 | </body> |
| 2508 | </html> |