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> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
Junio C Hamano | d9d71c0 | 2006-02-08 00:52:33 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 7.0.2" /> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | <style type="text/css"> |
| 8 | /* Debug borders */ |
| 9 | p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { |
| 10 | /* |
| 11 | border: 1px solid red; |
| 12 | */ |
| 13 | } |
| 14 | |
| 15 | body { |
| 16 | margin: 1em 5% 1em 5%; |
| 17 | } |
| 18 | |
| 19 | a { color: blue; } |
| 20 | a:visited { color: fuchsia; } |
| 21 | |
| 22 | em { |
| 23 | font-style: italic; |
| 24 | } |
| 25 | |
| 26 | strong { |
| 27 | font-weight: bold; |
| 28 | } |
| 29 | |
| 30 | tt { |
| 31 | color: navy; |
| 32 | } |
| 33 | |
| 34 | h1, h2, h3, h4, h5, h6 { |
| 35 | color: #527bbd; |
| 36 | font-family: sans-serif; |
| 37 | margin-top: 1.2em; |
| 38 | margin-bottom: 0.5em; |
| 39 | line-height: 1.3; |
| 40 | } |
| 41 | |
| 42 | h1 { |
| 43 | border-bottom: 2px solid silver; |
| 44 | } |
| 45 | h2 { |
| 46 | border-bottom: 2px solid silver; |
| 47 | padding-top: 0.5em; |
| 48 | } |
| 49 | |
| 50 | div.sectionbody { |
| 51 | font-family: serif; |
| 52 | margin-left: 0; |
| 53 | } |
| 54 | |
| 55 | hr { |
| 56 | border: 1px solid silver; |
| 57 | } |
| 58 | |
| 59 | p { |
| 60 | margin-top: 0.5em; |
| 61 | margin-bottom: 0.5em; |
| 62 | } |
| 63 | |
| 64 | pre { |
| 65 | padding: 0; |
| 66 | margin: 0; |
| 67 | } |
| 68 | |
| 69 | span#author { |
| 70 | color: #527bbd; |
| 71 | font-family: sans-serif; |
| 72 | font-weight: bold; |
| 73 | font-size: 1.2em; |
| 74 | } |
| 75 | span#email { |
| 76 | } |
| 77 | span#revision { |
| 78 | font-family: sans-serif; |
| 79 | } |
| 80 | |
| 81 | div#footer { |
| 82 | font-family: sans-serif; |
| 83 | font-size: small; |
| 84 | border-top: 2px solid silver; |
| 85 | padding-top: 0.5em; |
| 86 | margin-top: 4.0em; |
| 87 | } |
| 88 | div#footer-text { |
| 89 | float: left; |
| 90 | padding-bottom: 0.5em; |
| 91 | } |
| 92 | div#footer-badges { |
| 93 | float: right; |
| 94 | padding-bottom: 0.5em; |
| 95 | } |
| 96 | |
| 97 | div#preamble, |
| 98 | div.tableblock, div.imageblock, div.exampleblock, div.verseblock, |
| 99 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 100 | div.admonitionblock { |
| 101 | margin-right: 10%; |
| 102 | margin-top: 1.5em; |
| 103 | margin-bottom: 1.5em; |
| 104 | } |
| 105 | div.admonitionblock { |
| 106 | margin-top: 2.5em; |
| 107 | margin-bottom: 2.5em; |
| 108 | } |
| 109 | |
| 110 | div.content { /* Block element content. */ |
| 111 | padding: 0; |
| 112 | } |
| 113 | |
| 114 | /* Block element titles. */ |
| 115 | div.title, caption.title { |
| 116 | font-family: sans-serif; |
| 117 | font-weight: bold; |
| 118 | text-align: left; |
| 119 | margin-top: 1.0em; |
| 120 | margin-bottom: 0.5em; |
| 121 | } |
| 122 | div.title + * { |
| 123 | margin-top: 0; |
| 124 | } |
| 125 | |
| 126 | td div.title:first-child { |
| 127 | margin-top: 0.0em; |
| 128 | } |
| 129 | div.content div.title:first-child { |
| 130 | margin-top: 0.0em; |
| 131 | } |
| 132 | div.content + div.title { |
| 133 | margin-top: 0.0em; |
| 134 | } |
| 135 | |
| 136 | div.sidebarblock > div.content { |
| 137 | background: #ffffee; |
| 138 | border: 1px solid silver; |
| 139 | padding: 0.5em; |
| 140 | } |
| 141 | |
| 142 | div.listingblock > div.content { |
| 143 | border: 1px solid silver; |
| 144 | background: #f4f4f4; |
| 145 | padding: 0.5em; |
| 146 | } |
| 147 | |
| 148 | div.quoteblock > div.content { |
| 149 | padding-left: 2.0em; |
| 150 | } |
| 151 | div.quoteblock .attribution { |
| 152 | text-align: right; |
| 153 | } |
| 154 | |
| 155 | div.admonitionblock .icon { |
| 156 | vertical-align: top; |
| 157 | font-size: 1.1em; |
| 158 | font-weight: bold; |
| 159 | text-decoration: underline; |
| 160 | color: #527bbd; |
| 161 | padding-right: 0.5em; |
| 162 | } |
| 163 | div.admonitionblock td.content { |
| 164 | padding-left: 0.5em; |
| 165 | border-left: 2px solid silver; |
| 166 | } |
| 167 | |
| 168 | div.exampleblock > div.content { |
| 169 | border-left: 2px solid silver; |
| 170 | padding: 0.5em; |
| 171 | } |
| 172 | |
| 173 | div.verseblock div.content { |
| 174 | white-space: pre; |
| 175 | } |
| 176 | |
| 177 | div.imageblock div.content { padding-left: 0; } |
| 178 | div.imageblock img { border: 1px solid silver; } |
| 179 | span.image img { border-style: none; } |
| 180 | |
| 181 | dl { |
| 182 | margin-top: 0.8em; |
| 183 | margin-bottom: 0.8em; |
| 184 | } |
| 185 | dt { |
| 186 | margin-top: 0.5em; |
| 187 | margin-bottom: 0; |
| 188 | font-style: italic; |
| 189 | } |
| 190 | dd > *:first-child { |
| 191 | margin-top: 0; |
| 192 | } |
| 193 | |
| 194 | ul, ol { |
| 195 | list-style-position: outside; |
| 196 | } |
| 197 | ol.olist2 { |
| 198 | list-style-type: lower-alpha; |
| 199 | } |
| 200 | |
| 201 | div.tableblock > table { |
| 202 | border-color: #527bbd; |
| 203 | border-width: 3px; |
| 204 | } |
| 205 | thead { |
| 206 | font-family: sans-serif; |
| 207 | font-weight: bold; |
| 208 | } |
| 209 | tfoot { |
| 210 | font-weight: bold; |
| 211 | } |
| 212 | |
| 213 | div.hlist { |
| 214 | margin-top: 0.8em; |
| 215 | margin-bottom: 0.8em; |
| 216 | } |
| 217 | td.hlist1 { |
| 218 | vertical-align: top; |
| 219 | font-style: italic; |
| 220 | padding-right: 0.8em; |
| 221 | } |
| 222 | td.hlist2 { |
| 223 | vertical-align: top; |
| 224 | } |
| 225 | |
| 226 | @media print { |
| 227 | div#footer-badges { display: none; } |
| 228 | } |
| 229 | include::./stylesheets/xhtml11-manpage.css[] |
| 230 | /* Workarounds for IE6's broken and incomplete CSS2. */ |
| 231 | |
| 232 | div.sidebar-content { |
| 233 | background: #ffffee; |
| 234 | border: 1px solid silver; |
| 235 | padding: 0.5em; |
| 236 | } |
| 237 | div.sidebar-title, div.image-title { |
| 238 | font-family: sans-serif; |
| 239 | font-weight: bold; |
| 240 | margin-top: 0.0em; |
| 241 | margin-bottom: 0.5em; |
| 242 | } |
| 243 | |
| 244 | div.listingblock div.content { |
| 245 | border: 1px solid silver; |
| 246 | background: #f4f4f4; |
| 247 | padding: 0.5em; |
| 248 | } |
| 249 | |
| 250 | div.quoteblock-content { |
| 251 | padding-left: 2.0em; |
| 252 | } |
| 253 | |
| 254 | div.exampleblock-content { |
| 255 | border-left: 2px solid silver; |
| 256 | padding-left: 0.5em; |
| 257 | } |
| 258 | </style> |
| 259 | <title>git-diff-tree(1)</title> |
| 260 | </head> |
| 261 | <body> |
| 262 | <div id="header"> |
| 263 | <h1> |
| 264 | git-diff-tree(1) Manual Page |
| 265 | </h1> |
| 266 | <h2>NAME</h2> |
| 267 | <div class="sectionbody"> |
| 268 | <p>git-diff-tree - |
| 269 | Compares the content and mode of blobs found via two tree objects |
| 270 | </p> |
| 271 | </div> |
| 272 | </div> |
| 273 | <h2>SYNOPSIS</h2> |
| 274 | <div class="sectionbody"> |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 275 | <div class="verseblock"> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 276 | <div class="content"><em>git-diff-tree</em> [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty] |
| 277 | [-t] [-r] [-c | --cc] [--root] [<common diff options>] |
| 278 | <tree-ish> [<tree-ish>] [<path>…]</div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 279 | </div> |
| 280 | <h2>DESCRIPTION</h2> |
| 281 | <div class="sectionbody"> |
| 282 | <p>Compares the content and mode of the blobs found via two tree objects.</p> |
| 283 | <p>If there is only one <tree-ish> given, the commit is compared with its parents |
| 284 | (see --stdin below).</p> |
| 285 | <p>Note that "git-diff-tree" can use the tree encapsulated in a commit object.</p> |
| 286 | </div> |
| 287 | <h2>OPTIONS</h2> |
| 288 | <div class="sectionbody"> |
| 289 | <dl> |
| 290 | <dt> |
| 291 | -p |
| 292 | </dt> |
| 293 | <dd> |
| 294 | <p> |
Junio C Hamano | ff97979 | 2007-11-16 10:11:30 | [diff] [blame] | 295 | Generate patch (see section on generating patches). |
| 296 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 297 | </p> |
| 298 | </dd> |
| 299 | <dt> |
| 300 | -u |
| 301 | </dt> |
| 302 | <dd> |
| 303 | <p> |
| 304 | Synonym for "-p". |
| 305 | </p> |
| 306 | </dd> |
| 307 | <dt> |
Junio C Hamano | 6936156 | 2007-07-26 02:14:34 | [diff] [blame] | 308 | -U<n> |
| 309 | </dt> |
| 310 | <dd> |
| 311 | <p> |
| 312 | Shorthand for "--unified=<n>". |
| 313 | </p> |
| 314 | </dd> |
| 315 | <dt> |
| 316 | --unified=<n> |
| 317 | </dt> |
| 318 | <dd> |
| 319 | <p> |
| 320 | Generate diffs with <n> lines of context instead of |
| 321 | the usual three. Implies "-p". |
| 322 | </p> |
| 323 | </dd> |
| 324 | <dt> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 325 | --raw |
| 326 | </dt> |
| 327 | <dd> |
| 328 | <p> |
| 329 | Generate the raw format. |
Junio C Hamano | ff97979 | 2007-11-16 10:11:30 | [diff] [blame] | 330 | This is the default. |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 331 | </p> |
| 332 | </dd> |
| 333 | <dt> |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 334 | --patch-with-raw |
| 335 | </dt> |
| 336 | <dd> |
| 337 | <p> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 338 | Synonym for "-p --raw". |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 339 | </p> |
| 340 | </dd> |
| 341 | <dt> |
Junio C Hamano | 4a9a76a | 2006-10-01 05:40:29 | [diff] [blame] | 342 | --stat[=width[,name-width]] |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 343 | </dt> |
| 344 | <dd> |
| 345 | <p> |
Junio C Hamano | 4a9a76a | 2006-10-01 05:40:29 | [diff] [blame] | 346 | Generate a diffstat. You can override the default |
| 347 | output width for 80-column terminal by "--stat=width". |
| 348 | The width of the filename part can be controlled by |
| 349 | giving another width to it separated by a comma. |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 350 | </p> |
| 351 | </dd> |
| 352 | <dt> |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 353 | --numstat |
| 354 | </dt> |
| 355 | <dd> |
| 356 | <p> |
| 357 | Similar to --stat, but shows number of added and |
| 358 | deleted lines in decimal notation and pathname without |
Junio C Hamano | d793de5 | 2006-12-26 09:11:43 | [diff] [blame] | 359 | abbreviation, to make it more machine friendly. For |
| 360 | binary files, outputs two <tt>-</tt> instead of saying |
| 361 | <tt>0 0</tt>. |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 362 | </p> |
| 363 | </dd> |
| 364 | <dt> |
Junio C Hamano | 7d23f5e | 2006-12-16 07:44:04 | [diff] [blame] | 365 | --shortstat |
| 366 | </dt> |
| 367 | <dd> |
| 368 | <p> |
| 369 | Output only the last line of the --stat format containing total |
| 370 | number of modified files, as well as number of added and deleted |
| 371 | lines. |
| 372 | </p> |
| 373 | </dd> |
| 374 | <dt> |
Junio C Hamano | 6959c6c | 2006-05-17 10:34:11 | [diff] [blame] | 375 | --summary |
| 376 | </dt> |
| 377 | <dd> |
| 378 | <p> |
| 379 | Output a condensed summary of extended header information |
| 380 | such as creations, renames and mode changes. |
| 381 | </p> |
| 382 | </dd> |
| 383 | <dt> |
Junio C Hamano | d1308c9 | 2006-04-16 11:01:09 | [diff] [blame] | 384 | --patch-with-stat |
| 385 | </dt> |
| 386 | <dd> |
| 387 | <p> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 388 | Synonym for "-p --stat". |
Junio C Hamano | ff97979 | 2007-11-16 10:11:30 | [diff] [blame] | 389 | |
Junio C Hamano | d1308c9 | 2006-04-16 11:01:09 | [diff] [blame] | 390 | </p> |
| 391 | </dd> |
| 392 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 393 | -z |
| 394 | </dt> |
| 395 | <dd> |
| 396 | <p> |
Junio C Hamano | b968dbb | 2007-07-27 07:26:40 | [diff] [blame] | 397 | NUL-line termination on output. This affects the --raw |
| 398 | output field terminator. Also output from commands such |
| 399 | as "git-log" will be delimited with NUL between commits. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 400 | </p> |
| 401 | </dd> |
| 402 | <dt> |
| 403 | --name-only |
| 404 | </dt> |
| 405 | <dd> |
| 406 | <p> |
| 407 | Show only names of changed files. |
| 408 | </p> |
| 409 | </dd> |
| 410 | <dt> |
| 411 | --name-status |
| 412 | </dt> |
| 413 | <dd> |
| 414 | <p> |
| 415 | Show only names and status of changed files. |
| 416 | </p> |
| 417 | </dd> |
| 418 | <dt> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 419 | --color |
| 420 | </dt> |
| 421 | <dd> |
| 422 | <p> |
| 423 | Show colored diff. |
| 424 | </p> |
| 425 | </dd> |
| 426 | <dt> |
| 427 | --no-color |
| 428 | </dt> |
| 429 | <dd> |
| 430 | <p> |
| 431 | Turn off colored diff, even when the configuration file |
| 432 | gives the default to color output. |
| 433 | </p> |
| 434 | </dd> |
| 435 | <dt> |
Junio C Hamano | 85e45fa | 2006-08-13 07:47:41 | [diff] [blame] | 436 | --color-words |
| 437 | </dt> |
| 438 | <dd> |
| 439 | <p> |
| 440 | Show colored word diff, i.e. color words which have changed. |
| 441 | </p> |
| 442 | </dd> |
| 443 | <dt> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 444 | --no-renames |
| 445 | </dt> |
| 446 | <dd> |
| 447 | <p> |
| 448 | Turn off rename detection, even when the configuration |
| 449 | file gives the default to do so. |
| 450 | </p> |
| 451 | </dd> |
| 452 | <dt> |
Junio C Hamano | a890c4f | 2007-01-28 10:29:21 | [diff] [blame] | 453 | --check |
| 454 | </dt> |
| 455 | <dd> |
| 456 | <p> |
| 457 | Warn if changes introduce trailing whitespace |
Junio C Hamano | 3dac504 | 2007-12-15 08:40:54 | [diff] [blame] | 458 | or an indent that uses a space before a tab. Exits with |
| 459 | non-zero status if problems are found. Not compatible with |
| 460 | --exit-code. |
Junio C Hamano | a890c4f | 2007-01-28 10:29:21 | [diff] [blame] | 461 | </p> |
| 462 | </dd> |
| 463 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 464 | --full-index |
| 465 | </dt> |
| 466 | <dd> |
| 467 | <p> |
| 468 | Instead of the first handful characters, show full |
| 469 | object name of pre- and post-image blob on the "index" |
| 470 | line when generating a patch format output. |
| 471 | </p> |
| 472 | </dd> |
| 473 | <dt> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 474 | --binary |
| 475 | </dt> |
| 476 | <dd> |
| 477 | <p> |
| 478 | In addition to --full-index, output "binary diff" that |
| 479 | can be applied with "git apply". |
| 480 | </p> |
| 481 | </dd> |
| 482 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 483 | --abbrev[=<n>] |
| 484 | </dt> |
| 485 | <dd> |
| 486 | <p> |
| 487 | Instead of showing the full 40-byte hexadecimal object |
| 488 | name in diff-raw format output and diff-tree header |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 489 | lines, show only handful hexdigits prefix. This is |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 490 | independent of --full-index option above, which controls |
| 491 | the diff-patch output format. Non default number of |
| 492 | digits can be specified with --abbrev=<n>. |
| 493 | </p> |
| 494 | </dd> |
| 495 | <dt> |
| 496 | -B |
| 497 | </dt> |
| 498 | <dd> |
| 499 | <p> |
| 500 | Break complete rewrite changes into pairs of delete and create. |
| 501 | </p> |
| 502 | </dd> |
| 503 | <dt> |
| 504 | -M |
| 505 | </dt> |
| 506 | <dd> |
| 507 | <p> |
| 508 | Detect renames. |
| 509 | </p> |
| 510 | </dd> |
| 511 | <dt> |
| 512 | -C |
| 513 | </dt> |
| 514 | <dd> |
| 515 | <p> |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 516 | Detect copies as well as renames. See also <tt>--find-copies-harder</tt>. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 517 | </p> |
| 518 | </dd> |
| 519 | <dt> |
Junio C Hamano | 6ec31b9 | 2006-02-10 05:52:01 | [diff] [blame] | 520 | --diff-filter=[ACDMRTUXB*] |
| 521 | </dt> |
| 522 | <dd> |
| 523 | <p> |
| 524 | Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>), |
| 525 | Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their |
| 526 | type (mode) changed (<tt>T</tt>), are Unmerged (<tt>U</tt>), are |
| 527 | Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>). |
| 528 | Any combination of the filter characters may be used. |
| 529 | When <tt>*</tt> (All-or-none) is added to the combination, all |
| 530 | paths are selected if there is any file that matches |
| 531 | other criteria in the comparison; if there is no file |
| 532 | that matches other criteria, nothing is selected. |
| 533 | </p> |
| 534 | </dd> |
| 535 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 536 | --find-copies-harder |
| 537 | </dt> |
| 538 | <dd> |
| 539 | <p> |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 540 | For performance reasons, by default, <tt>-C</tt> option finds copies only |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 541 | if the original file of the copy was modified in the same |
| 542 | changeset. This flag makes the command |
| 543 | inspect unmodified files as candidates for the source of |
| 544 | copy. This is a very expensive operation for large |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 545 | projects, so use it with caution. Giving more than one |
| 546 | <tt>-C</tt> option has the same effect. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 547 | </p> |
| 548 | </dd> |
| 549 | <dt> |
| 550 | -l<num> |
| 551 | </dt> |
| 552 | <dd> |
| 553 | <p> |
| 554 | -M and -C options require O(n^2) processing time where n |
| 555 | is the number of potential rename/copy targets. This |
| 556 | option prevents rename/copy detection from running if |
| 557 | the number of rename/copy targets exceeds the specified |
| 558 | number. |
| 559 | </p> |
| 560 | </dd> |
| 561 | <dt> |
| 562 | -S<string> |
| 563 | </dt> |
| 564 | <dd> |
| 565 | <p> |
| 566 | Look for differences that contain the change in <string>. |
| 567 | </p> |
| 568 | </dd> |
| 569 | <dt> |
| 570 | --pickaxe-all |
| 571 | </dt> |
| 572 | <dd> |
| 573 | <p> |
| 574 | When -S finds a change, show all the changes in that |
| 575 | changeset, not just the files that contain the change |
| 576 | in <string>. |
| 577 | </p> |
| 578 | </dd> |
| 579 | <dt> |
Junio C Hamano | bfe9e75 | 2006-04-05 21:43:28 | [diff] [blame] | 580 | --pickaxe-regex |
| 581 | </dt> |
| 582 | <dd> |
| 583 | <p> |
| 584 | Make the <string> not a plain string but an extended POSIX |
| 585 | regex to match. |
| 586 | </p> |
| 587 | </dd> |
| 588 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 589 | -O<orderfile> |
| 590 | </dt> |
| 591 | <dd> |
| 592 | <p> |
| 593 | Output the patch in the order specified in the |
| 594 | <orderfile>, which has one shell glob pattern per line. |
| 595 | </p> |
| 596 | </dd> |
| 597 | <dt> |
| 598 | -R |
| 599 | </dt> |
| 600 | <dd> |
| 601 | <p> |
| 602 | Swap two inputs; that is, show differences from index or |
| 603 | on-disk file to tree contents. |
| 604 | </p> |
| 605 | </dd> |
Junio C Hamano | c26f548 | 2006-07-09 09:38:14 | [diff] [blame] | 606 | <dt> |
Junio C Hamano | 24bc09a | 2008-02-28 00:27:44 | [diff] [blame^] | 607 | --relative[=<path>] |
| 608 | </dt> |
| 609 | <dd> |
| 610 | <p> |
| 611 | When run from a subdirectory of the project, it can be |
| 612 | told to exclude changes outside the directory and show |
| 613 | pathnames relative to it with this option. When you are |
| 614 | not in a subdirectory (e.g. in a bare repository), you |
| 615 | can name which subdirectory to make the output relative |
| 616 | to by giving a <path> as an argument. |
| 617 | </p> |
| 618 | </dd> |
| 619 | <dt> |
Junio C Hamano | c26f548 | 2006-07-09 09:38:14 | [diff] [blame] | 620 | --text |
| 621 | </dt> |
| 622 | <dd> |
| 623 | <p> |
| 624 | Treat all files as text. |
| 625 | </p> |
| 626 | </dd> |
| 627 | <dt> |
| 628 | -a |
| 629 | </dt> |
| 630 | <dd> |
| 631 | <p> |
| 632 | Shorthand for "--text". |
| 633 | </p> |
| 634 | </dd> |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 635 | <dt> |
Junio C Hamano | fd46896 | 2007-02-14 23:45:04 | [diff] [blame] | 636 | --ignore-space-at-eol |
| 637 | </dt> |
| 638 | <dd> |
| 639 | <p> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 640 | Ignore changes in whitespace at EOL. |
Junio C Hamano | fd46896 | 2007-02-14 23:45:04 | [diff] [blame] | 641 | </p> |
| 642 | </dd> |
| 643 | <dt> |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 644 | --ignore-space-change |
| 645 | </dt> |
| 646 | <dd> |
| 647 | <p> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 648 | Ignore changes in amount of whitespace. This ignores whitespace |
| 649 | at line end, and considers all other sequences of one or |
| 650 | more whitespace characters to be equivalent. |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 651 | </p> |
| 652 | </dd> |
| 653 | <dt> |
| 654 | -b |
| 655 | </dt> |
| 656 | <dd> |
| 657 | <p> |
| 658 | Shorthand for "--ignore-space-change". |
| 659 | </p> |
| 660 | </dd> |
| 661 | <dt> |
| 662 | --ignore-all-space |
| 663 | </dt> |
| 664 | <dd> |
| 665 | <p> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 666 | Ignore whitespace when comparing lines. This ignores |
| 667 | differences even if one line has whitespace where the other |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 668 | line has none. |
| 669 | </p> |
| 670 | </dd> |
| 671 | <dt> |
| 672 | -w |
| 673 | </dt> |
| 674 | <dd> |
| 675 | <p> |
| 676 | Shorthand for "--ignore-all-space". |
| 677 | </p> |
| 678 | </dd> |
Junio C Hamano | 48fd2f6 | 2007-03-19 02:02:30 | [diff] [blame] | 679 | <dt> |
| 680 | --exit-code |
| 681 | </dt> |
| 682 | <dd> |
| 683 | <p> |
| 684 | Make the program exit with codes similar to diff(1). |
| 685 | That is, it exits with 1 if there were differences and |
| 686 | 0 means no differences. |
| 687 | </p> |
| 688 | </dd> |
Junio C Hamano | 35e5755 | 2007-03-25 07:54:35 | [diff] [blame] | 689 | <dt> |
| 690 | --quiet |
| 691 | </dt> |
| 692 | <dd> |
| 693 | <p> |
| 694 | Disable all output of the program. Implies --exit-code. |
| 695 | </p> |
| 696 | </dd> |
Junio C Hamano | bb0f404 | 2007-07-04 06:41:40 | [diff] [blame] | 697 | <dt> |
| 698 | --ext-diff |
| 699 | </dt> |
| 700 | <dd> |
| 701 | <p> |
| 702 | Allow an external diff helper to be executed. If you set an |
Junio C Hamano | 1b50ce9 | 2007-10-03 12:05:53 | [diff] [blame] | 703 | external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need |
| 704 | 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] | 705 | </p> |
| 706 | </dd> |
| 707 | <dt> |
| 708 | --no-ext-diff |
| 709 | </dt> |
| 710 | <dd> |
| 711 | <p> |
| 712 | Disallow external diff drivers. |
| 713 | </p> |
| 714 | </dd> |
Junio C Hamano | e27cbd2 | 2007-12-21 17:57:33 | [diff] [blame] | 715 | <dt> |
| 716 | --src-prefix=<prefix> |
| 717 | </dt> |
| 718 | <dd> |
| 719 | <p> |
| 720 | Show the given source prefix instead of "a/". |
| 721 | </p> |
| 722 | </dd> |
| 723 | <dt> |
| 724 | --dst-prefix=<prefix> |
| 725 | </dt> |
| 726 | <dd> |
| 727 | <p> |
| 728 | Show the given destination prefix instead of "b/". |
| 729 | </p> |
| 730 | </dd> |
| 731 | <dt> |
| 732 | --no-prefix |
| 733 | </dt> |
| 734 | <dd> |
| 735 | <p> |
| 736 | Do not show any source or destination prefix. |
| 737 | </p> |
| 738 | </dd> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 739 | </dl> |
| 740 | <p>For more detailed explanation on these common options, see also |
| 741 | <a href="diffcore.html">diffcore documentation</a>.</p> |
| 742 | <dl> |
| 743 | <dt> |
| 744 | <tree-ish> |
| 745 | </dt> |
| 746 | <dd> |
| 747 | <p> |
| 748 | The id of a tree object. |
| 749 | </p> |
| 750 | </dd> |
| 751 | <dt> |
| 752 | <path>… |
| 753 | </dt> |
| 754 | <dd> |
| 755 | <p> |
| 756 | If provided, the results are limited to a subset of files |
| 757 | matching one of these prefix strings. |
Junio C Hamano | 341071d | 2006-06-04 07:24:48 | [diff] [blame] | 758 | i.e., file matches <tt>/^<pattern1>|<pattern2>|…/</tt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 759 | Note that this parameter does not provide any wildcard or regexp |
| 760 | features. |
| 761 | </p> |
| 762 | </dd> |
| 763 | <dt> |
| 764 | -r |
| 765 | </dt> |
| 766 | <dd> |
| 767 | <p> |
| 768 | recurse into sub-trees |
| 769 | </p> |
| 770 | </dd> |
| 771 | <dt> |
| 772 | -t |
| 773 | </dt> |
| 774 | <dd> |
| 775 | <p> |
| 776 | show tree entry itself as well as subtrees. Implies -r. |
| 777 | </p> |
| 778 | </dd> |
| 779 | <dt> |
| 780 | --root |
| 781 | </dt> |
| 782 | <dd> |
| 783 | <p> |
| 784 | When <em>--root</em> is specified the initial commit will be showed as a big |
| 785 | creation event. This is equivalent to a diff against the NULL tree. |
| 786 | </p> |
| 787 | </dd> |
| 788 | <dt> |
| 789 | --stdin |
| 790 | </dt> |
| 791 | <dd> |
| 792 | <p> |
| 793 | When <em>--stdin</em> is specified, the command does not take |
| 794 | <tree-ish> arguments from the command line. Instead, it |
| 795 | reads either one <commit> or a pair of <tree-ish> |
| 796 | separated with a single space from its standard input. |
| 797 | </p> |
| 798 | <p>When a single commit is given on one line of such input, it compares |
| 799 | the commit with its parents. The following flags further affects its |
Junio C Hamano | 341071d | 2006-06-04 07:24:48 | [diff] [blame] | 800 | behavior. This does not apply to the case where two <tree-ish> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 801 | separated with a single space are given.</p> |
| 802 | </dd> |
| 803 | <dt> |
| 804 | -m |
| 805 | </dt> |
| 806 | <dd> |
| 807 | <p> |
| 808 | By default, "git-diff-tree --stdin" does not show |
| 809 | differences for merge commits. With this flag, it shows |
Junio C Hamano | a8adb1e | 2006-04-10 23:46:16 | [diff] [blame] | 810 | differences to that commit from all of its parents. See |
| 811 | also <em>-c</em>. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 812 | </p> |
| 813 | </dd> |
| 814 | <dt> |
| 815 | -s |
| 816 | </dt> |
| 817 | <dd> |
| 818 | <p> |
| 819 | By default, "git-diff-tree --stdin" shows differences, |
| 820 | either in machine-readable form (without <em>-p</em>) or in patch |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 821 | form (with <em>-p</em>). This output can be suppressed. It is |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 822 | only useful with <em>-v</em> flag. |
| 823 | </p> |
| 824 | </dd> |
| 825 | <dt> |
| 826 | -v |
| 827 | </dt> |
| 828 | <dd> |
| 829 | <p> |
| 830 | This flag causes "git-diff-tree --stdin" to also show |
| 831 | the commit message before the differences. |
| 832 | </p> |
| 833 | </dd> |
| 834 | <dt> |
Junio C Hamano | a340aaa | 2006-11-23 02:47:33 | [diff] [blame] | 835 | --pretty[=<em><format></em>] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 836 | </dt> |
| 837 | <dd> |
| 838 | <p> |
Junio C Hamano | a3770f9 | 2007-07-25 08:53:33 | [diff] [blame] | 839 | Pretty-print the contents of the commit logs in a given format, |
Junio C Hamano | 0430e3a | 2007-05-15 03:13:17 | [diff] [blame] | 840 | where <em><format></em> can be one of <em>oneline</em>, <em>short</em>, <em>medium</em>, |
| 841 | <em>full</em>, <em>fuller</em>, <em>email</em>, <em>raw</em> and <em>format:<string></em>. |
Junio C Hamano | a3770f9 | 2007-07-25 08:53:33 | [diff] [blame] | 842 | When omitted, the format defaults to <em>medium</em>. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 843 | </p> |
Junio C Hamano | 0430e3a | 2007-05-15 03:13:17 | [diff] [blame] | 844 | </dd> |
| 845 | <dt> |
Junio C Hamano | ee695f2 | 2007-06-21 00:35:36 | [diff] [blame] | 846 | --abbrev-commit |
| 847 | </dt> |
| 848 | <dd> |
| 849 | <p> |
| 850 | Instead of showing the full 40-byte hexadecimal commit object |
| 851 | name, show only handful hexdigits prefix. Non default number of |
| 852 | digits can be specified with "--abbrev=<n>" (which also modifies |
| 853 | diff output, if it is displayed). |
| 854 | </p> |
| 855 | <p>This should make "--pretty=oneline" a whole lot more readable for |
| 856 | people using 80-column terminals.</p> |
| 857 | </dd> |
| 858 | <dt> |
Junio C Hamano | 0430e3a | 2007-05-15 03:13:17 | [diff] [blame] | 859 | --encoding[=<encoding>] |
| 860 | </dt> |
| 861 | <dd> |
| 862 | <p> |
| 863 | The commit objects record the encoding used for the log message |
| 864 | in their encoding header; this option can be used to tell the |
| 865 | command to re-code the commit log message in the encoding |
| 866 | preferred by the user. For non plumbing commands this |
| 867 | defaults to UTF-8. |
| 868 | </p> |
| 869 | </dd> |
| 870 | <dt> |
| 871 | --no-commit-id |
| 872 | </dt> |
| 873 | <dd> |
| 874 | <p> |
| 875 | git-diff-tree outputs a line with the commit ID when |
| 876 | applicable. This flag suppressed the commit ID output. |
| 877 | </p> |
| 878 | </dd> |
| 879 | <dt> |
| 880 | -c |
| 881 | </dt> |
| 882 | <dd> |
| 883 | <p> |
| 884 | This flag changes the way a merge commit is displayed |
| 885 | (which means it is useful only when the command is given |
| 886 | one <tree-ish>, or <em>--stdin</em>). It shows the differences |
| 887 | from each of the parents to the merge result simultaneously |
| 888 | instead of showing pairwise diff between a parent and the |
| 889 | result one at a time (which is what the <em>-m</em> option does). |
| 890 | Furthermore, it lists only files which were modified |
| 891 | from all parents. |
| 892 | </p> |
| 893 | </dd> |
| 894 | <dt> |
| 895 | --cc |
| 896 | </dt> |
| 897 | <dd> |
| 898 | <p> |
| 899 | This flag changes the way a merge commit patch is displayed, |
| 900 | in a similar way to the <em>-c</em> option. It implies the <em>-c</em> |
| 901 | and <em>-p</em> options and further compresses the patch output |
| 902 | by omitting hunks that show differences from only one |
| 903 | parent, or show the same change from all but one parent |
| 904 | for an Octopus merge. When this optimization makes all |
| 905 | hunks disappear, the commit itself and the commit log |
| 906 | message is not shown, just like in any other "empty diff" case. |
| 907 | </p> |
| 908 | </dd> |
| 909 | <dt> |
| 910 | --always |
| 911 | </dt> |
| 912 | <dd> |
| 913 | <p> |
| 914 | Show the commit itself and the commit log message even |
| 915 | if the diff itself is empty. |
| 916 | </p> |
| 917 | </dd> |
| 918 | </dl> |
| 919 | </div> |
| 920 | <h2>PRETTY FORMATS</h2> |
| 921 | <div class="sectionbody"> |
| 922 | <p>If the commit is a merge, and if the pretty-format |
| 923 | is not <em>oneline</em>, <em>email</em> or <em>raw</em>, an additional line is |
| 924 | inserted before the <em>Author:</em> line. This line begins with |
| 925 | "Merge: " and the sha1s of ancestral commits are printed, |
| 926 | separated by spaces. Note that the listed commits may not |
| 927 | necessarily be the list of the <strong>direct</strong> parent commits if you |
| 928 | have limited your view of history: for example, if you are |
| 929 | only interested in changes related to a certain directory or |
| 930 | file.</p> |
| 931 | <p>Here are some additional details for each format:</p> |
Junio C Hamano | a340aaa | 2006-11-23 02:47:33 | [diff] [blame] | 932 | <ul> |
| 933 | <li> |
| 934 | <p> |
| 935 | <em>oneline</em> |
| 936 | </p> |
| 937 | <div class="literalblock"> |
| 938 | <div class="content"> |
| 939 | <pre><tt><sha1> <title line></tt></pre> |
| 940 | </div></div> |
| 941 | <p>This is designed to be as compact as possible.</p> |
| 942 | </li> |
| 943 | <li> |
| 944 | <p> |
| 945 | <em>short</em> |
| 946 | </p> |
| 947 | <div class="literalblock"> |
| 948 | <div class="content"> |
| 949 | <pre><tt>commit <sha1> |
| 950 | Author: <author></tt></pre> |
| 951 | </div></div> |
| 952 | <div class="literalblock"> |
| 953 | <div class="content"> |
| 954 | <pre><tt><title line></tt></pre> |
| 955 | </div></div> |
| 956 | </li> |
| 957 | <li> |
| 958 | <p> |
| 959 | <em>medium</em> |
| 960 | </p> |
| 961 | <div class="literalblock"> |
| 962 | <div class="content"> |
| 963 | <pre><tt>commit <sha1> |
| 964 | Author: <author> |
| 965 | Date: <date></tt></pre> |
| 966 | </div></div> |
| 967 | <div class="literalblock"> |
| 968 | <div class="content"> |
| 969 | <pre><tt><title line></tt></pre> |
| 970 | </div></div> |
| 971 | <div class="literalblock"> |
| 972 | <div class="content"> |
| 973 | <pre><tt><full commit message></tt></pre> |
| 974 | </div></div> |
| 975 | </li> |
| 976 | <li> |
| 977 | <p> |
| 978 | <em>full</em> |
| 979 | </p> |
| 980 | <div class="literalblock"> |
| 981 | <div class="content"> |
| 982 | <pre><tt>commit <sha1> |
| 983 | Author: <author> |
| 984 | Commit: <committer></tt></pre> |
| 985 | </div></div> |
| 986 | <div class="literalblock"> |
| 987 | <div class="content"> |
| 988 | <pre><tt><title line></tt></pre> |
| 989 | </div></div> |
| 990 | <div class="literalblock"> |
| 991 | <div class="content"> |
| 992 | <pre><tt><full commit message></tt></pre> |
| 993 | </div></div> |
| 994 | </li> |
| 995 | <li> |
| 996 | <p> |
| 997 | <em>fuller</em> |
| 998 | </p> |
| 999 | <div class="literalblock"> |
| 1000 | <div class="content"> |
| 1001 | <pre><tt>commit <sha1> |
| 1002 | Author: <author> |
| 1003 | AuthorDate: <date & time> |
| 1004 | Commit: <committer> |
| 1005 | CommitDate: <date & time></tt></pre> |
| 1006 | </div></div> |
| 1007 | <div class="literalblock"> |
| 1008 | <div class="content"> |
| 1009 | <pre><tt><title line></tt></pre> |
| 1010 | </div></div> |
| 1011 | <div class="literalblock"> |
| 1012 | <div class="content"> |
| 1013 | <pre><tt><full commit message></tt></pre> |
| 1014 | </div></div> |
| 1015 | </li> |
| 1016 | <li> |
| 1017 | <p> |
| 1018 | <em>email</em> |
| 1019 | </p> |
| 1020 | <div class="literalblock"> |
| 1021 | <div class="content"> |
| 1022 | <pre><tt>From <sha1> <date> |
| 1023 | From: <author> |
| 1024 | Date: <date & time> |
| 1025 | Subject: [PATCH] <title line></tt></pre> |
| 1026 | </div></div> |
| 1027 | <div class="literalblock"> |
| 1028 | <div class="content"> |
Junio C Hamano | 0430e3a | 2007-05-15 03:13:17 | [diff] [blame] | 1029 | <pre><tt><full commit message></tt></pre> |
Junio C Hamano | a340aaa | 2006-11-23 02:47:33 | [diff] [blame] | 1030 | </div></div> |
| 1031 | </li> |
| 1032 | <li> |
| 1033 | <p> |
| 1034 | <em>raw</em> |
| 1035 | </p> |
| 1036 | <p>The <em>raw</em> format shows the entire commit exactly as |
| 1037 | stored in the commit object. Notably, the SHA1s are |
| 1038 | displayed in full, regardless of whether --abbrev or |
| 1039 | --no-abbrev are used, and <em>parents</em> information show the |
| 1040 | true parent commits, without taking grafts nor history |
| 1041 | simplification into account.</p> |
| 1042 | </li> |
Junio C Hamano | a3fd83c | 2007-03-02 10:34:36 | [diff] [blame] | 1043 | <li> |
| 1044 | <p> |
| 1045 | <em>format:</em> |
| 1046 | </p> |
| 1047 | <p>The <em>format:</em> format allows you to specify which information |
| 1048 | you want to show. It works a little bit like printf format, |
| 1049 | with the notable exception that you get a newline with <em>%n</em> |
| 1050 | instead of <em>\n</em>.</p> |
Junio C Hamano | 0430e3a | 2007-05-15 03:13:17 | [diff] [blame] | 1051 | <p>E.g, <em>format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"</em> |
Junio C Hamano | a3fd83c | 2007-03-02 10:34:36 | [diff] [blame] | 1052 | would show something like this:</p> |
Junio C Hamano | 0430e3a | 2007-05-15 03:13:17 | [diff] [blame] | 1053 | <div class="listingblock"> |
| 1054 | <div class="content"> |
| 1055 | <pre><tt>The author of fe6e0ee was Junio C Hamano, 23 hours ago |
| 1056 | The title was >>t4119: test autocomputing -p<n> for traditional diff input.<< |
| 1057 | </tt></pre> |
| 1058 | </div></div> |
Junio C Hamano | a3fd83c | 2007-03-02 10:34:36 | [diff] [blame] | 1059 | <p>The placeholders are:</p> |
| 1060 | <ul> |
| 1061 | <li> |
| 1062 | <p> |
| 1063 | <em>%H</em>: commit hash |
| 1064 | </p> |
| 1065 | </li> |
| 1066 | <li> |
| 1067 | <p> |
| 1068 | <em>%h</em>: abbreviated commit hash |
| 1069 | </p> |
| 1070 | </li> |
| 1071 | <li> |
| 1072 | <p> |
| 1073 | <em>%T</em>: tree hash |
| 1074 | </p> |
| 1075 | </li> |
| 1076 | <li> |
| 1077 | <p> |
| 1078 | <em>%t</em>: abbreviated tree hash |
| 1079 | </p> |
| 1080 | </li> |
| 1081 | <li> |
| 1082 | <p> |
| 1083 | <em>%P</em>: parent hashes |
| 1084 | </p> |
| 1085 | </li> |
| 1086 | <li> |
| 1087 | <p> |
| 1088 | <em>%p</em>: abbreviated parent hashes |
| 1089 | </p> |
| 1090 | </li> |
| 1091 | <li> |
| 1092 | <p> |
| 1093 | <em>%an</em>: author name |
| 1094 | </p> |
| 1095 | </li> |
| 1096 | <li> |
| 1097 | <p> |
| 1098 | <em>%ae</em>: author email |
| 1099 | </p> |
| 1100 | </li> |
| 1101 | <li> |
| 1102 | <p> |
| 1103 | <em>%ad</em>: author date |
| 1104 | </p> |
| 1105 | </li> |
| 1106 | <li> |
| 1107 | <p> |
| 1108 | <em>%aD</em>: author date, RFC2822 style |
| 1109 | </p> |
| 1110 | </li> |
| 1111 | <li> |
| 1112 | <p> |
| 1113 | <em>%ar</em>: author date, relative |
| 1114 | </p> |
| 1115 | </li> |
| 1116 | <li> |
| 1117 | <p> |
| 1118 | <em>%at</em>: author date, UNIX timestamp |
| 1119 | </p> |
| 1120 | </li> |
| 1121 | <li> |
| 1122 | <p> |
Junio C Hamano | 02f130b | 2007-07-14 08:26:56 | [diff] [blame] | 1123 | <em>%ai</em>: author date, ISO 8601 format |
| 1124 | </p> |
| 1125 | </li> |
| 1126 | <li> |
| 1127 | <p> |
Junio C Hamano | a3fd83c | 2007-03-02 10:34:36 | [diff] [blame] | 1128 | <em>%cn</em>: committer name |
| 1129 | </p> |
| 1130 | </li> |
| 1131 | <li> |
| 1132 | <p> |
| 1133 | <em>%ce</em>: committer email |
| 1134 | </p> |
| 1135 | </li> |
| 1136 | <li> |
| 1137 | <p> |
| 1138 | <em>%cd</em>: committer date |
| 1139 | </p> |
| 1140 | </li> |
| 1141 | <li> |
| 1142 | <p> |
| 1143 | <em>%cD</em>: committer date, RFC2822 style |
| 1144 | </p> |
| 1145 | </li> |
| 1146 | <li> |
| 1147 | <p> |
| 1148 | <em>%cr</em>: committer date, relative |
| 1149 | </p> |
| 1150 | </li> |
| 1151 | <li> |
| 1152 | <p> |
| 1153 | <em>%ct</em>: committer date, UNIX timestamp |
| 1154 | </p> |
| 1155 | </li> |
| 1156 | <li> |
| 1157 | <p> |
Junio C Hamano | 02f130b | 2007-07-14 08:26:56 | [diff] [blame] | 1158 | <em>%ci</em>: committer date, ISO 8601 format |
| 1159 | </p> |
| 1160 | </li> |
| 1161 | <li> |
| 1162 | <p> |
Junio C Hamano | a3fd83c | 2007-03-02 10:34:36 | [diff] [blame] | 1163 | <em>%e</em>: encoding |
| 1164 | </p> |
| 1165 | </li> |
| 1166 | <li> |
| 1167 | <p> |
| 1168 | <em>%s</em>: subject |
| 1169 | </p> |
| 1170 | </li> |
| 1171 | <li> |
| 1172 | <p> |
| 1173 | <em>%b</em>: body |
| 1174 | </p> |
| 1175 | </li> |
| 1176 | <li> |
| 1177 | <p> |
| 1178 | <em>%Cred</em>: switch color to red |
| 1179 | </p> |
| 1180 | </li> |
| 1181 | <li> |
| 1182 | <p> |
| 1183 | <em>%Cgreen</em>: switch color to green |
| 1184 | </p> |
| 1185 | </li> |
| 1186 | <li> |
| 1187 | <p> |
| 1188 | <em>%Cblue</em>: switch color to blue |
| 1189 | </p> |
| 1190 | </li> |
| 1191 | <li> |
| 1192 | <p> |
| 1193 | <em>%Creset</em>: reset color |
| 1194 | </p> |
| 1195 | </li> |
| 1196 | <li> |
| 1197 | <p> |
Junio C Hamano | d9e0e5d | 2007-04-14 16:22:04 | [diff] [blame] | 1198 | <em>%m</em>: left, right or boundary mark |
| 1199 | </p> |
| 1200 | </li> |
| 1201 | <li> |
| 1202 | <p> |
Junio C Hamano | a3fd83c | 2007-03-02 10:34:36 | [diff] [blame] | 1203 | <em>%n</em>: newline |
| 1204 | </p> |
Junio C Hamano | 0430e3a | 2007-05-15 03:13:17 | [diff] [blame] | 1205 | </li> |
| 1206 | </ul> |
Junio C Hamano | a3fd83c | 2007-03-02 10:34:36 | [diff] [blame] | 1207 | </li> |
| 1208 | </ul> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1209 | </div> |
| 1210 | <h2>Limiting Output</h2> |
| 1211 | <div class="sectionbody"> |
| 1212 | <p>If you're only interested in differences in a subset of files, for |
| 1213 | example some architecture-specific files, you might do:</p> |
| 1214 | <div class="literalblock"> |
| 1215 | <div class="content"> |
| 1216 | <pre><tt>git-diff-tree -r <tree-ish> <tree-ish> arch/ia64 include/asm-ia64</tt></pre> |
| 1217 | </div></div> |
| 1218 | <p>and it will only show you what changed in those two directories.</p> |
| 1219 | <p>Or if you are searching for what changed in just <tt>kernel/sched.c</tt>, just do</p> |
| 1220 | <div class="literalblock"> |
| 1221 | <div class="content"> |
| 1222 | <pre><tt>git-diff-tree -r <tree-ish> <tree-ish> kernel/sched.c</tt></pre> |
| 1223 | </div></div> |
| 1224 | <p>and it will ignore all differences to other files.</p> |
| 1225 | <p>The pattern is always the prefix, and is matched exactly. There are no |
| 1226 | wildcards. Even stricter, it has to match a complete path component. |
| 1227 | I.e. "foo" does not pick up <tt>foobar.h</tt>. "foo" does match <tt>foo/bar.h</tt> |
| 1228 | so it can be used to name subdirectories.</p> |
| 1229 | <p>An example of normal usage is:</p> |
| 1230 | <div class="literalblock"> |
| 1231 | <div class="content"> |
| 1232 | <pre><tt>torvalds@ppc970:~/git> git-diff-tree 5319e4...... |
| 1233 | *100664->100664 blob ac348b.......->a01513....... git-fsck-objects.c</tt></pre> |
| 1234 | </div></div> |
| 1235 | <p>which tells you that the last commit changed just one file (it's from |
| 1236 | this one:</p> |
| 1237 | <div class="listingblock"> |
| 1238 | <div class="content"> |
| 1239 | <pre><tt>commit 3c6f7ca19ad4043e9e72fa94106f352897e651a8 |
| 1240 | tree 5319e4d609cdd282069cc4dce33c1db559539b03 |
| 1241 | parent b4e628ea30d5ab3606119d2ea5caeab141d38df7 |
| 1242 | author Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005 |
| 1243 | committer Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005 |
| 1244 | |
| 1245 | Make "git-fsck-objects" print out all the root commits it finds. |
| 1246 | |
| 1247 | Once I do the reference tracking, I'll also make it print out all the |
| 1248 | HEAD commits it finds, which is even more interesting.</tt></pre> |
| 1249 | </div></div> |
| 1250 | <p>in case you care).</p> |
| 1251 | </div> |
| 1252 | <h2>Output format</h2> |
| 1253 | <div class="sectionbody"> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1254 | <p>The output format from "git-diff-index", "git-diff-tree", |
| 1255 | "git-diff-files" and "git diff --raw" are very similar.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1256 | <p>These commands all compare two sets of things; what is |
| 1257 | compared differs:</p> |
| 1258 | <dl> |
| 1259 | <dt> |
| 1260 | git-diff-index <tree-ish> |
| 1261 | </dt> |
| 1262 | <dd> |
| 1263 | <p> |
| 1264 | compares the <tree-ish> and the files on the filesystem. |
| 1265 | </p> |
| 1266 | </dd> |
| 1267 | <dt> |
| 1268 | git-diff-index --cached <tree-ish> |
| 1269 | </dt> |
| 1270 | <dd> |
| 1271 | <p> |
| 1272 | compares the <tree-ish> and the index. |
| 1273 | </p> |
| 1274 | </dd> |
| 1275 | <dt> |
| 1276 | git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>…] |
| 1277 | </dt> |
| 1278 | <dd> |
| 1279 | <p> |
| 1280 | compares the trees named by the two arguments. |
| 1281 | </p> |
| 1282 | </dd> |
| 1283 | <dt> |
| 1284 | git-diff-files [<pattern>…] |
| 1285 | </dt> |
| 1286 | <dd> |
| 1287 | <p> |
| 1288 | compares the index and the files on the filesystem. |
| 1289 | </p> |
| 1290 | </dd> |
| 1291 | </dl> |
| 1292 | <p>An output line is formatted this way:</p> |
| 1293 | <div class="listingblock"> |
| 1294 | <div class="content"> |
| 1295 | <pre><tt>in-place edit :100644 100644 bcd1234... 0123456... M file0 |
| 1296 | copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2 |
| 1297 | rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3 |
| 1298 | create :000000 100644 0000000... 1234567... A file4 |
| 1299 | delete :100644 000000 1234567... 0000000... D file5 |
| 1300 | unmerged :000000 000000 0000000... 0000000... U file6</tt></pre> |
| 1301 | </div></div> |
| 1302 | <p>That is, from the left to the right:</p> |
| 1303 | <ol> |
| 1304 | <li> |
| 1305 | <p> |
| 1306 | a colon. |
| 1307 | </p> |
| 1308 | </li> |
| 1309 | <li> |
| 1310 | <p> |
| 1311 | mode for "src"; 000000 if creation or unmerged. |
| 1312 | </p> |
| 1313 | </li> |
| 1314 | <li> |
| 1315 | <p> |
| 1316 | a space. |
| 1317 | </p> |
| 1318 | </li> |
| 1319 | <li> |
| 1320 | <p> |
| 1321 | mode for "dst"; 000000 if deletion or unmerged. |
| 1322 | </p> |
| 1323 | </li> |
| 1324 | <li> |
| 1325 | <p> |
| 1326 | a space. |
| 1327 | </p> |
| 1328 | </li> |
| 1329 | <li> |
| 1330 | <p> |
| 1331 | sha1 for "src"; 0{40} if creation or unmerged. |
| 1332 | </p> |
| 1333 | </li> |
| 1334 | <li> |
| 1335 | <p> |
| 1336 | a space. |
| 1337 | </p> |
| 1338 | </li> |
| 1339 | <li> |
| 1340 | <p> |
| 1341 | sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree". |
| 1342 | </p> |
| 1343 | </li> |
| 1344 | <li> |
| 1345 | <p> |
| 1346 | a space. |
| 1347 | </p> |
| 1348 | </li> |
| 1349 | <li> |
| 1350 | <p> |
| 1351 | status, followed by optional "score" number. |
| 1352 | </p> |
| 1353 | </li> |
| 1354 | <li> |
| 1355 | <p> |
| 1356 | a tab or a NUL when <em>-z</em> option is used. |
| 1357 | </p> |
| 1358 | </li> |
| 1359 | <li> |
| 1360 | <p> |
| 1361 | path for "src" |
| 1362 | </p> |
| 1363 | </li> |
| 1364 | <li> |
| 1365 | <p> |
| 1366 | a tab or a NUL when <em>-z</em> option is used; only exists for C or R. |
| 1367 | </p> |
| 1368 | </li> |
| 1369 | <li> |
| 1370 | <p> |
| 1371 | path for "dst"; only exists for C or R. |
| 1372 | </p> |
| 1373 | </li> |
| 1374 | <li> |
| 1375 | <p> |
| 1376 | an LF or a NUL when <em>-z</em> option is used, to terminate the record. |
| 1377 | </p> |
| 1378 | </li> |
| 1379 | </ol> |
| 1380 | <p><sha1> is shown as all 0's if a file is new on the filesystem |
| 1381 | and it is out of sync with the index.</p> |
| 1382 | <p>Example:</p> |
| 1383 | <div class="listingblock"> |
| 1384 | <div class="content"> |
| 1385 | <pre><tt>:100644 100644 5be4a4...... 000000...... M file.c</tt></pre> |
| 1386 | </div></div> |
| 1387 | <p>When <tt>-z</tt> option is not used, TAB, LF, and backslash characters |
| 1388 | in pathnames are represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>, |
| 1389 | respectively.</p> |
| 1390 | </div> |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 1391 | <h2>diff format for merges</h2> |
| 1392 | <div class="sectionbody"> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1393 | <p>"git-diff-tree", "git-diff-files" and "git-diff --raw" |
| 1394 | can take <em>-c</em> or <em>--cc</em> option |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 1395 | to generate diff output also for merge commits. The output differs |
| 1396 | from the format described above in the following way:</p> |
| 1397 | <ol> |
| 1398 | <li> |
| 1399 | <p> |
| 1400 | there is a colon for each parent |
| 1401 | </p> |
| 1402 | </li> |
| 1403 | <li> |
| 1404 | <p> |
| 1405 | there are more "src" modes and "src" sha1 |
| 1406 | </p> |
| 1407 | </li> |
| 1408 | <li> |
| 1409 | <p> |
| 1410 | status is concatenated status characters for each parent |
| 1411 | </p> |
| 1412 | </li> |
| 1413 | <li> |
| 1414 | <p> |
| 1415 | no optional "score" number |
| 1416 | </p> |
| 1417 | </li> |
| 1418 | <li> |
| 1419 | <p> |
| 1420 | single path, only for "dst" |
| 1421 | </p> |
| 1422 | </li> |
| 1423 | </ol> |
| 1424 | <p>Example:</p> |
| 1425 | <div class="listingblock"> |
| 1426 | <div class="content"> |
| 1427 | <pre><tt>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</tt></pre> |
| 1428 | </div></div> |
| 1429 | <p>Note that <em>combined diff</em> lists only files which were modified from |
| 1430 | all parents.</p> |
| 1431 | </div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1432 | <h2>Generating patches with -p</h2> |
| 1433 | <div class="sectionbody"> |
| 1434 | <p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run |
Junio C Hamano | 00b8b63 | 2007-12-07 09:50:49 | [diff] [blame] | 1435 | with a <em>-p</em> option, "git diff" without the <em>--raw</em> option, or |
| 1436 | "git log" with the "-p" option, they |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1437 | do not produce the output described above; instead they produce a |
| 1438 | patch file. You can customize the creation of such patches via the |
| 1439 | GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p> |
Junio C Hamano | 1c43712 | 2006-11-28 02:22:25 | [diff] [blame] | 1440 | <p>What the -p option produces is slightly different from the traditional |
| 1441 | diff format.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1442 | <ol> |
| 1443 | <li> |
| 1444 | <p> |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 1445 | It is preceded with a "git diff" header, that looks like |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1446 | this: |
| 1447 | </p> |
| 1448 | <div class="literalblock"> |
| 1449 | <div class="content"> |
| 1450 | <pre><tt>diff --git a/file1 b/file2</tt></pre> |
| 1451 | </div></div> |
| 1452 | <p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is |
| 1453 | involved. Especially, even for a creation or a deletion, |
| 1454 | <tt>/dev/null</tt> is _not_ used in place of <tt>a/</tt> or <tt>b/</tt> filenames.</p> |
| 1455 | <p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the |
| 1456 | name of the source file of the rename/copy and the name of |
| 1457 | the file that rename/copy produces, respectively.</p> |
| 1458 | </li> |
| 1459 | <li> |
| 1460 | <p> |
| 1461 | It is followed by one or more extended header lines: |
| 1462 | </p> |
| 1463 | <div class="literalblock"> |
| 1464 | <div class="content"> |
| 1465 | <pre><tt>old mode <mode> |
| 1466 | new mode <mode> |
| 1467 | deleted file mode <mode> |
| 1468 | new file mode <mode> |
| 1469 | copy from <path> |
| 1470 | copy to <path> |
| 1471 | rename from <path> |
| 1472 | rename to <path> |
| 1473 | similarity index <number> |
| 1474 | dissimilarity index <number> |
| 1475 | index <hash>..<hash> <mode></tt></pre> |
| 1476 | </div></div> |
| 1477 | </li> |
| 1478 | <li> |
| 1479 | <p> |
Junio C Hamano | a053d54 | 2006-10-27 09:29:13 | [diff] [blame] | 1480 | TAB, LF, double quote and backslash characters in pathnames |
| 1481 | are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and <tt>\\</tt>, respectively. |
| 1482 | If there is need for such substitution then the whole |
| 1483 | pathname is put in double quotes. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1484 | </p> |
| 1485 | </li> |
| 1486 | </ol> |
Junio C Hamano | d526ba9 | 2007-07-02 00:17:42 | [diff] [blame] | 1487 | <p>The similarity index is the percentage of unchanged lines, and |
| 1488 | the dissimilarity index is the percentage of changed lines. It |
| 1489 | is a rounded down integer, followed by a percent sign. The |
| 1490 | similarity index value of 100% is thus reserved for two equal |
| 1491 | files, while 100% dissimilarity means that no line from the old |
| 1492 | file made it into the new one.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1493 | </div> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1494 | <h2>combined diff format</h2> |
| 1495 | <div class="sectionbody"> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1496 | <p>"git-diff-tree", "git-diff-files" and "git-diff" can take <em>-c</em> or |
Junio C Hamano | 00b8b63 | 2007-12-07 09:50:49 | [diff] [blame] | 1497 | <em>--cc</em> option to produce <em>combined diff</em>. For showing a merge commit |
| 1498 | with "git log -p", this is the default format. |
| 1499 | A <em>combined diff</em> format looks like this:</p> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1500 | <div class="listingblock"> |
| 1501 | <div class="content"> |
| 1502 | <pre><tt>diff --combined describe.c |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 1503 | index fabadb8,cc95eb0..4866510 |
| 1504 | --- a/describe.c |
| 1505 | +++ b/describe.c |
| 1506 | @@@ -98,20 -98,12 +98,20 @@@ |
| 1507 | return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1; |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1508 | } |
| 1509 | |
| 1510 | - static void describe(char *arg) |
| 1511 | -static void describe(struct commit *cmit, int last_one) |
| 1512 | ++static void describe(char *arg, int last_one) |
| 1513 | { |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 1514 | + unsigned char sha1[20]; |
| 1515 | + struct commit *cmit; |
| 1516 | struct commit_list *list; |
| 1517 | static int initialized = 0; |
| 1518 | struct commit_name *n; |
| 1519 | |
| 1520 | + if (get_sha1(arg, sha1) < 0) |
| 1521 | + usage(describe_usage); |
| 1522 | + cmit = lookup_commit_reference(sha1); |
| 1523 | + if (!cmit) |
| 1524 | + usage(describe_usage); |
| 1525 | + |
| 1526 | if (!initialized) { |
| 1527 | initialized = 1; |
| 1528 | for_each_ref(get_name);</tt></pre> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1529 | </div></div> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 1530 | <ol> |
| 1531 | <li> |
| 1532 | <p> |
| 1533 | It is preceded with a "git diff" header, that looks like |
| 1534 | this (when <em>-c</em> option is used): |
| 1535 | </p> |
| 1536 | <div class="literalblock"> |
| 1537 | <div class="content"> |
| 1538 | <pre><tt>diff --combined file</tt></pre> |
| 1539 | </div></div> |
| 1540 | <p>or like this (when <em>--cc</em> option is used):</p> |
| 1541 | <div class="literalblock"> |
| 1542 | <div class="content"> |
| 1543 | <pre><tt>diff --c file</tt></pre> |
| 1544 | </div></div> |
| 1545 | </li> |
| 1546 | <li> |
| 1547 | <p> |
| 1548 | It is followed by one or more extended header lines |
| 1549 | (this example shows a merge with two parents): |
| 1550 | </p> |
| 1551 | <div class="literalblock"> |
| 1552 | <div class="content"> |
| 1553 | <pre><tt>index <hash>,<hash>..<hash> |
| 1554 | mode <mode>,<mode>..<mode> |
| 1555 | new file mode <mode> |
| 1556 | deleted file mode <mode>,<mode></tt></pre> |
| 1557 | </div></div> |
| 1558 | <p>The <tt>mode <mode>,<mode>..<mode></tt> line appears only if at least one of |
Junio C Hamano | ee1e428 | 2007-02-04 08:32:04 | [diff] [blame] | 1559 | the <mode> is different from the rest. Extended headers with |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 1560 | information about detected contents movement (renames and |
| 1561 | copying detection) are designed to work with diff of two |
| 1562 | <tree-ish> and are not used by combined diff format.</p> |
| 1563 | </li> |
| 1564 | <li> |
| 1565 | <p> |
| 1566 | It is followed by two-line from-file/to-file header |
| 1567 | </p> |
| 1568 | <div class="literalblock"> |
| 1569 | <div class="content"> |
| 1570 | <pre><tt>--- a/file |
| 1571 | +++ b/file</tt></pre> |
| 1572 | </div></div> |
| 1573 | <p>Similar to two-line header for traditional <em>unified</em> diff |
| 1574 | format, <tt>/dev/null</tt> is used to signal created or deleted |
| 1575 | files.</p> |
| 1576 | </li> |
| 1577 | <li> |
| 1578 | <p> |
| 1579 | Chunk header format is modified to prevent people from |
| 1580 | accidentally feeding it to <tt>patch -p1</tt>. Combined diff format |
| 1581 | was created for review of merge commit changes, and was not |
| 1582 | meant for apply. The change is similar to the change in the |
| 1583 | extended <em>index</em> header: |
| 1584 | </p> |
| 1585 | <div class="literalblock"> |
| 1586 | <div class="content"> |
| 1587 | <pre><tt>@@@ <from-file-range> <from-file-range> <to-file-range> @@@</tt></pre> |
| 1588 | </div></div> |
| 1589 | <p>There are (number of parents + 1) <tt>@</tt> characters in the chunk |
| 1590 | header for combined diff format.</p> |
| 1591 | </li> |
| 1592 | </ol> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1593 | <p>Unlike the traditional <em>unified</em> diff format, which shows two |
| 1594 | files A and B with a single column that has <tt>-</tt> (minus — |
| 1595 | appears in A but removed in B), <tt>+</tt> (plus — missing in A but |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 1596 | added to B), or <tt>" "</tt> (space — unchanged) prefix, this format |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1597 | compares two or more files file1, file2,… with one file X, and |
| 1598 | shows how X differs from each of fileN. One column for each of |
| 1599 | fileN is prepended to the output line to note how X's line is |
| 1600 | different from it.</p> |
| 1601 | <p>A <tt>-</tt> character in the column N means that the line appears in |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 1602 | fileN but it does not appear in the result. A <tt>+</tt> character |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1603 | in the column N means that the line appears in the last file, |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 1604 | and fileN does not have that line (in other words, the line was |
| 1605 | added, from the point of view of that parent).</p> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1606 | <p>In the above example output, the function signature was changed |
| 1607 | from both files (hence two <tt>-</tt> removals from both file1 and |
| 1608 | file2, plus <tt>++</tt> to mean one line that was added does not appear |
| 1609 | in either file1 nor file2). Also two other lines are the same |
| 1610 | from file1 but do not appear in file2 (hence prefixed with <tt> +</tt>).</p> |
| 1611 | <p>When shown by <tt>git diff-tree -c</tt>, it compares the parents of a |
| 1612 | merge commit with the merge result (i.e. file1..fileN are the |
| 1613 | parents). When shown by <tt>git diff-files -c</tt>, it compares the |
| 1614 | two unresolved merge parents with the working tree file |
| 1615 | (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka |
| 1616 | "their version").</p> |
| 1617 | </div> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 1618 | <h2>other diff formats</h2> |
| 1619 | <div class="sectionbody"> |
| 1620 | <p>The <tt>--summary</tt> option describes newly added, deleted, renamed and |
| 1621 | copied files. The <tt>--stat</tt> option adds diffstat(1) graph to the |
| 1622 | output. These options can be combined with other options, such as |
| 1623 | <tt>-p</tt>, and are meant for human consumption.</p> |
| 1624 | <p>When showing a change that involves a rename or a copy, <tt>--stat</tt> output |
| 1625 | formats the pathnames compactly by combining common prefix and suffix of |
| 1626 | the pathnames. For example, a change that moves <tt>arch/i386/Makefile</tt> to |
| 1627 | <tt>arch/x86/Makefile</tt> while modifying 4 lines will be shown like this:</p> |
| 1628 | <div class="listingblock"> |
| 1629 | <div class="content"> |
| 1630 | <pre><tt>arch/{i386 => x86}/Makefile | 4 +--</tt></pre> |
| 1631 | </div></div> |
| 1632 | <p>The <tt>--numstat</tt> option gives the diffstat(1) information but is designed |
| 1633 | for easier machine consumption. An entry in <tt>--numstat</tt> output looks |
| 1634 | like this:</p> |
| 1635 | <div class="listingblock"> |
| 1636 | <div class="content"> |
| 1637 | <pre><tt>1 2 README |
| 1638 | 3 1 arch/{i386 => x86}/Makefile</tt></pre> |
| 1639 | </div></div> |
| 1640 | <p>That is, from left to right:</p> |
| 1641 | <ol> |
| 1642 | <li> |
| 1643 | <p> |
| 1644 | the number of added lines; |
| 1645 | </p> |
| 1646 | </li> |
| 1647 | <li> |
| 1648 | <p> |
| 1649 | a tab; |
| 1650 | </p> |
| 1651 | </li> |
| 1652 | <li> |
| 1653 | <p> |
| 1654 | the number of deleted lines; |
| 1655 | </p> |
| 1656 | </li> |
| 1657 | <li> |
| 1658 | <p> |
| 1659 | a tab; |
| 1660 | </p> |
| 1661 | </li> |
| 1662 | <li> |
| 1663 | <p> |
| 1664 | pathname (possibly with rename/copy information); |
| 1665 | </p> |
| 1666 | </li> |
| 1667 | <li> |
| 1668 | <p> |
| 1669 | a newline. |
| 1670 | </p> |
| 1671 | </li> |
| 1672 | </ol> |
| 1673 | <p>When <tt>-z</tt> output option is in effect, the output is formatted this way:</p> |
| 1674 | <div class="listingblock"> |
| 1675 | <div class="content"> |
| 1676 | <pre><tt>1 2 README NUL |
| 1677 | 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</tt></pre> |
| 1678 | </div></div> |
| 1679 | <p>That is:</p> |
| 1680 | <ol> |
| 1681 | <li> |
| 1682 | <p> |
| 1683 | the number of added lines; |
| 1684 | </p> |
| 1685 | </li> |
| 1686 | <li> |
| 1687 | <p> |
| 1688 | a tab; |
| 1689 | </p> |
| 1690 | </li> |
| 1691 | <li> |
| 1692 | <p> |
| 1693 | the number of deleted lines; |
| 1694 | </p> |
| 1695 | </li> |
| 1696 | <li> |
| 1697 | <p> |
| 1698 | a tab; |
| 1699 | </p> |
| 1700 | </li> |
| 1701 | <li> |
| 1702 | <p> |
| 1703 | a NUL (only exists if renamed/copied); |
| 1704 | </p> |
| 1705 | </li> |
| 1706 | <li> |
| 1707 | <p> |
| 1708 | pathname in preimage; |
| 1709 | </p> |
| 1710 | </li> |
| 1711 | <li> |
| 1712 | <p> |
| 1713 | a NUL (only exists if renamed/copied); |
| 1714 | </p> |
| 1715 | </li> |
| 1716 | <li> |
| 1717 | <p> |
| 1718 | pathname in postimage (only exists if renamed/copied); |
| 1719 | </p> |
| 1720 | </li> |
| 1721 | <li> |
| 1722 | <p> |
| 1723 | a NUL. |
| 1724 | </p> |
| 1725 | </li> |
| 1726 | </ol> |
| 1727 | <p>The extra <tt>NUL</tt> before the preimage path in renamed case is to allow |
| 1728 | scripts that read the output to tell if the current record being read is |
| 1729 | a single-path record or a rename/copy record without reading ahead. |
| 1730 | After reading added and deleted lines, reading up to <tt>NUL</tt> would yield |
| 1731 | the pathname, but if that is <tt>NUL</tt>, the record will show two paths.</p> |
| 1732 | </div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1733 | <h2>Author</h2> |
| 1734 | <div class="sectionbody"> |
| 1735 | <p>Written by Linus Torvalds <torvalds@osdl.org></p> |
| 1736 | </div> |
| 1737 | <h2>Documentation</h2> |
| 1738 | <div class="sectionbody"> |
| 1739 | <p>Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.</p> |
| 1740 | </div> |
| 1741 | <h2>GIT</h2> |
| 1742 | <div class="sectionbody"> |
| 1743 | <p>Part of the <a href="git.html">git(7)</a> suite</p> |
| 1744 | </div> |
| 1745 | <div id="footer"> |
| 1746 | <div id="footer-text"> |
Junio C Hamano | 24bc09a | 2008-02-28 00:27:44 | [diff] [blame^] | 1747 | Last updated 28-Feb-2008 00:25:39 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1748 | </div> |
| 1749 | </div> |
| 1750 | </body> |
| 1751 | </html> |