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> |
| 295 | Generate patch (see section on generating patches) |
| 296 | </p> |
| 297 | </dd> |
| 298 | <dt> |
| 299 | -u |
| 300 | </dt> |
| 301 | <dd> |
| 302 | <p> |
| 303 | Synonym for "-p". |
| 304 | </p> |
| 305 | </dd> |
| 306 | <dt> |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 307 | --patch-with-raw |
| 308 | </dt> |
| 309 | <dd> |
| 310 | <p> |
| 311 | Generate patch but keep also the default raw diff output. |
| 312 | </p> |
| 313 | </dd> |
| 314 | <dt> |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 315 | --stat |
| 316 | </dt> |
| 317 | <dd> |
| 318 | <p> |
| 319 | Generate a diffstat instead of a patch. |
| 320 | </p> |
| 321 | </dd> |
| 322 | <dt> |
Junio C Hamano | 6959c6c | 2006-05-17 10:34:11 | [diff] [blame] | 323 | --summary |
| 324 | </dt> |
| 325 | <dd> |
| 326 | <p> |
| 327 | Output a condensed summary of extended header information |
| 328 | such as creations, renames and mode changes. |
| 329 | </p> |
| 330 | </dd> |
| 331 | <dt> |
Junio C Hamano | d1308c9 | 2006-04-16 11:01:09 | [diff] [blame] | 332 | --patch-with-stat |
| 333 | </dt> |
| 334 | <dd> |
| 335 | <p> |
| 336 | Generate patch and prepend its diffstat. |
| 337 | </p> |
| 338 | </dd> |
| 339 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 340 | -z |
| 341 | </dt> |
| 342 | <dd> |
| 343 | <p> |
| 344 | \0 line termination on output |
| 345 | </p> |
| 346 | </dd> |
| 347 | <dt> |
| 348 | --name-only |
| 349 | </dt> |
| 350 | <dd> |
| 351 | <p> |
| 352 | Show only names of changed files. |
| 353 | </p> |
| 354 | </dd> |
| 355 | <dt> |
| 356 | --name-status |
| 357 | </dt> |
| 358 | <dd> |
| 359 | <p> |
| 360 | Show only names and status of changed files. |
| 361 | </p> |
| 362 | </dd> |
| 363 | <dt> |
| 364 | --full-index |
| 365 | </dt> |
| 366 | <dd> |
| 367 | <p> |
| 368 | Instead of the first handful characters, show full |
| 369 | object name of pre- and post-image blob on the "index" |
| 370 | line when generating a patch format output. |
| 371 | </p> |
| 372 | </dd> |
| 373 | <dt> |
| 374 | --abbrev[=<n>] |
| 375 | </dt> |
| 376 | <dd> |
| 377 | <p> |
| 378 | Instead of showing the full 40-byte hexadecimal object |
| 379 | name in diff-raw format output and diff-tree header |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 380 | lines, show only handful hexdigits prefix. This is |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 381 | independent of --full-index option above, which controls |
| 382 | the diff-patch output format. Non default number of |
| 383 | digits can be specified with --abbrev=<n>. |
| 384 | </p> |
| 385 | </dd> |
| 386 | <dt> |
| 387 | -B |
| 388 | </dt> |
| 389 | <dd> |
| 390 | <p> |
| 391 | Break complete rewrite changes into pairs of delete and create. |
| 392 | </p> |
| 393 | </dd> |
| 394 | <dt> |
| 395 | -M |
| 396 | </dt> |
| 397 | <dd> |
| 398 | <p> |
| 399 | Detect renames. |
| 400 | </p> |
| 401 | </dd> |
| 402 | <dt> |
| 403 | -C |
| 404 | </dt> |
| 405 | <dd> |
| 406 | <p> |
| 407 | Detect copies as well as renames. |
| 408 | </p> |
| 409 | </dd> |
| 410 | <dt> |
Junio C Hamano | 6ec31b9 | 2006-02-10 05:52:01 | [diff] [blame] | 411 | --diff-filter=[ACDMRTUXB*] |
| 412 | </dt> |
| 413 | <dd> |
| 414 | <p> |
| 415 | Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>), |
| 416 | Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their |
| 417 | type (mode) changed (<tt>T</tt>), are Unmerged (<tt>U</tt>), are |
| 418 | Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>). |
| 419 | Any combination of the filter characters may be used. |
| 420 | When <tt>*</tt> (All-or-none) is added to the combination, all |
| 421 | paths are selected if there is any file that matches |
| 422 | other criteria in the comparison; if there is no file |
| 423 | that matches other criteria, nothing is selected. |
| 424 | </p> |
| 425 | </dd> |
| 426 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 427 | --find-copies-harder |
| 428 | </dt> |
| 429 | <dd> |
| 430 | <p> |
| 431 | For performance reasons, by default, -C option finds copies only |
| 432 | if the original file of the copy was modified in the same |
| 433 | changeset. This flag makes the command |
| 434 | inspect unmodified files as candidates for the source of |
| 435 | copy. This is a very expensive operation for large |
| 436 | projects, so use it with caution. |
| 437 | </p> |
| 438 | </dd> |
| 439 | <dt> |
| 440 | -l<num> |
| 441 | </dt> |
| 442 | <dd> |
| 443 | <p> |
| 444 | -M and -C options require O(n^2) processing time where n |
| 445 | is the number of potential rename/copy targets. This |
| 446 | option prevents rename/copy detection from running if |
| 447 | the number of rename/copy targets exceeds the specified |
| 448 | number. |
| 449 | </p> |
| 450 | </dd> |
| 451 | <dt> |
| 452 | -S<string> |
| 453 | </dt> |
| 454 | <dd> |
| 455 | <p> |
| 456 | Look for differences that contain the change in <string>. |
| 457 | </p> |
| 458 | </dd> |
| 459 | <dt> |
| 460 | --pickaxe-all |
| 461 | </dt> |
| 462 | <dd> |
| 463 | <p> |
| 464 | When -S finds a change, show all the changes in that |
| 465 | changeset, not just the files that contain the change |
| 466 | in <string>. |
| 467 | </p> |
| 468 | </dd> |
| 469 | <dt> |
Junio C Hamano | bfe9e75 | 2006-04-05 21:43:28 | [diff] [blame] | 470 | --pickaxe-regex |
| 471 | </dt> |
| 472 | <dd> |
| 473 | <p> |
| 474 | Make the <string> not a plain string but an extended POSIX |
| 475 | regex to match. |
| 476 | </p> |
| 477 | </dd> |
| 478 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 479 | -O<orderfile> |
| 480 | </dt> |
| 481 | <dd> |
| 482 | <p> |
| 483 | Output the patch in the order specified in the |
| 484 | <orderfile>, which has one shell glob pattern per line. |
| 485 | </p> |
| 486 | </dd> |
| 487 | <dt> |
| 488 | -R |
| 489 | </dt> |
| 490 | <dd> |
| 491 | <p> |
| 492 | Swap two inputs; that is, show differences from index or |
| 493 | on-disk file to tree contents. |
| 494 | </p> |
| 495 | </dd> |
| 496 | </dl> |
| 497 | <p>For more detailed explanation on these common options, see also |
| 498 | <a href="diffcore.html">diffcore documentation</a>.</p> |
| 499 | <dl> |
| 500 | <dt> |
| 501 | <tree-ish> |
| 502 | </dt> |
| 503 | <dd> |
| 504 | <p> |
| 505 | The id of a tree object. |
| 506 | </p> |
| 507 | </dd> |
| 508 | <dt> |
| 509 | <path>… |
| 510 | </dt> |
| 511 | <dd> |
| 512 | <p> |
| 513 | If provided, the results are limited to a subset of files |
| 514 | matching one of these prefix strings. |
| 515 | ie file matches <tt>/^<pattern1>|<pattern2>|…/</tt> |
| 516 | Note that this parameter does not provide any wildcard or regexp |
| 517 | features. |
| 518 | </p> |
| 519 | </dd> |
| 520 | <dt> |
| 521 | -r |
| 522 | </dt> |
| 523 | <dd> |
| 524 | <p> |
| 525 | recurse into sub-trees |
| 526 | </p> |
| 527 | </dd> |
| 528 | <dt> |
| 529 | -t |
| 530 | </dt> |
| 531 | <dd> |
| 532 | <p> |
| 533 | show tree entry itself as well as subtrees. Implies -r. |
| 534 | </p> |
| 535 | </dd> |
| 536 | <dt> |
| 537 | --root |
| 538 | </dt> |
| 539 | <dd> |
| 540 | <p> |
| 541 | When <em>--root</em> is specified the initial commit will be showed as a big |
| 542 | creation event. This is equivalent to a diff against the NULL tree. |
| 543 | </p> |
| 544 | </dd> |
| 545 | <dt> |
| 546 | --stdin |
| 547 | </dt> |
| 548 | <dd> |
| 549 | <p> |
| 550 | When <em>--stdin</em> is specified, the command does not take |
| 551 | <tree-ish> arguments from the command line. Instead, it |
| 552 | reads either one <commit> or a pair of <tree-ish> |
| 553 | separated with a single space from its standard input. |
| 554 | </p> |
| 555 | <p>When a single commit is given on one line of such input, it compares |
| 556 | the commit with its parents. The following flags further affects its |
| 557 | behaviour. This does not apply to the case where two <tree-ish> |
| 558 | separated with a single space are given.</p> |
| 559 | </dd> |
| 560 | <dt> |
| 561 | -m |
| 562 | </dt> |
| 563 | <dd> |
| 564 | <p> |
| 565 | By default, "git-diff-tree --stdin" does not show |
| 566 | differences for merge commits. With this flag, it shows |
Junio C Hamano | a8adb1e | 2006-04-10 23:46:16 | [diff] [blame] | 567 | differences to that commit from all of its parents. See |
| 568 | also <em>-c</em>. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 569 | </p> |
| 570 | </dd> |
| 571 | <dt> |
| 572 | -s |
| 573 | </dt> |
| 574 | <dd> |
| 575 | <p> |
| 576 | By default, "git-diff-tree --stdin" shows differences, |
| 577 | either in machine-readable form (without <em>-p</em>) or in patch |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 578 | form (with <em>-p</em>). This output can be suppressed. It is |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 579 | only useful with <em>-v</em> flag. |
| 580 | </p> |
| 581 | </dd> |
| 582 | <dt> |
| 583 | -v |
| 584 | </dt> |
| 585 | <dd> |
| 586 | <p> |
| 587 | This flag causes "git-diff-tree --stdin" to also show |
| 588 | the commit message before the differences. |
| 589 | </p> |
| 590 | </dd> |
| 591 | <dt> |
| 592 | --pretty[=(raw|medium|short)] |
| 593 | </dt> |
| 594 | <dd> |
| 595 | <p> |
| 596 | This is used to control "pretty printing" format of the |
| 597 | commit message. Without "=<style>", it defaults to |
| 598 | medium. |
| 599 | </p> |
| 600 | </dd> |
| 601 | <dt> |
| 602 | --no-commit-id |
| 603 | </dt> |
| 604 | <dd> |
| 605 | <p> |
| 606 | git-diff-tree outputs a line with the commit ID when |
| 607 | applicable. This flag suppressed the commit ID output. |
| 608 | </p> |
| 609 | </dd> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 610 | <dt> |
Junio C Hamano | a8adb1e | 2006-04-10 23:46:16 | [diff] [blame] | 611 | -c |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 612 | </dt> |
| 613 | <dd> |
| 614 | <p> |
Junio C Hamano | a8adb1e | 2006-04-10 23:46:16 | [diff] [blame] | 615 | This flag changes the way a merge commit is displayed |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 616 | (which means it is useful only when the command is given |
| 617 | one <tree-ish>, or <em>--stdin</em>). It shows the differences |
Junio C Hamano | a8adb1e | 2006-04-10 23:46:16 | [diff] [blame] | 618 | from each of the parents to the merge result simultaneously |
| 619 | instead of showing pairwise diff between a parent and the |
| 620 | result one at a time (which is what the <em>-m</em> option does). |
| 621 | Furthermore, it lists only files which were modified |
| 622 | from all parents. |
| 623 | </p> |
| 624 | </dd> |
| 625 | <dt> |
Junio C Hamano | 46338f5 | 2006-05-04 00:46:44 | [diff] [blame] | 626 | --cc |
Junio C Hamano | a8adb1e | 2006-04-10 23:46:16 | [diff] [blame] | 627 | </dt> |
| 628 | <dd> |
| 629 | <p> |
| 630 | This flag changes the way a merge commit patch is displayed, |
| 631 | in a similar way to the <em>-c</em> option. It implies the <em>-c</em> |
| 632 | and <em>-p</em> options and further compresses the patch output |
| 633 | by omitting hunks that show differences from only one |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 634 | parent, or show the same change from all but one parent |
| 635 | for an Octopus merge. When this optimization makes all |
| 636 | hunks disappear, the commit itself and the commit log |
Junio C Hamano | a8adb1e | 2006-04-10 23:46:16 | [diff] [blame] | 637 | message is not shown, just like in any other "empty diff" case. |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 638 | </p> |
| 639 | </dd> |
Junio C Hamano | d9d71c0 | 2006-02-08 00:52:33 | [diff] [blame] | 640 | <dt> |
| 641 | --always |
| 642 | </dt> |
| 643 | <dd> |
| 644 | <p> |
| 645 | Show the commit itself and the commit log message even |
| 646 | if the diff itself is empty. |
| 647 | </p> |
| 648 | </dd> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 649 | </dl> |
| 650 | </div> |
| 651 | <h2>Limiting Output</h2> |
| 652 | <div class="sectionbody"> |
| 653 | <p>If you're only interested in differences in a subset of files, for |
| 654 | example some architecture-specific files, you might do:</p> |
| 655 | <div class="literalblock"> |
| 656 | <div class="content"> |
| 657 | <pre><tt>git-diff-tree -r <tree-ish> <tree-ish> arch/ia64 include/asm-ia64</tt></pre> |
| 658 | </div></div> |
| 659 | <p>and it will only show you what changed in those two directories.</p> |
| 660 | <p>Or if you are searching for what changed in just <tt>kernel/sched.c</tt>, just do</p> |
| 661 | <div class="literalblock"> |
| 662 | <div class="content"> |
| 663 | <pre><tt>git-diff-tree -r <tree-ish> <tree-ish> kernel/sched.c</tt></pre> |
| 664 | </div></div> |
| 665 | <p>and it will ignore all differences to other files.</p> |
| 666 | <p>The pattern is always the prefix, and is matched exactly. There are no |
| 667 | wildcards. Even stricter, it has to match a complete path component. |
| 668 | I.e. "foo" does not pick up <tt>foobar.h</tt>. "foo" does match <tt>foo/bar.h</tt> |
| 669 | so it can be used to name subdirectories.</p> |
| 670 | <p>An example of normal usage is:</p> |
| 671 | <div class="literalblock"> |
| 672 | <div class="content"> |
| 673 | <pre><tt>torvalds@ppc970:~/git> git-diff-tree 5319e4...... |
| 674 | *100664->100664 blob ac348b.......->a01513....... git-fsck-objects.c</tt></pre> |
| 675 | </div></div> |
| 676 | <p>which tells you that the last commit changed just one file (it's from |
| 677 | this one:</p> |
| 678 | <div class="listingblock"> |
| 679 | <div class="content"> |
| 680 | <pre><tt>commit 3c6f7ca19ad4043e9e72fa94106f352897e651a8 |
| 681 | tree 5319e4d609cdd282069cc4dce33c1db559539b03 |
| 682 | parent b4e628ea30d5ab3606119d2ea5caeab141d38df7 |
| 683 | author Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005 |
| 684 | committer Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005 |
| 685 | |
| 686 | Make "git-fsck-objects" print out all the root commits it finds. |
| 687 | |
| 688 | Once I do the reference tracking, I'll also make it print out all the |
| 689 | HEAD commits it finds, which is even more interesting.</tt></pre> |
| 690 | </div></div> |
| 691 | <p>in case you care).</p> |
| 692 | </div> |
| 693 | <h2>Output format</h2> |
| 694 | <div class="sectionbody"> |
| 695 | <p>The output format from "git-diff-index", "git-diff-tree" and |
| 696 | "git-diff-files" are very similar.</p> |
| 697 | <p>These commands all compare two sets of things; what is |
| 698 | compared differs:</p> |
| 699 | <dl> |
| 700 | <dt> |
| 701 | git-diff-index <tree-ish> |
| 702 | </dt> |
| 703 | <dd> |
| 704 | <p> |
| 705 | compares the <tree-ish> and the files on the filesystem. |
| 706 | </p> |
| 707 | </dd> |
| 708 | <dt> |
| 709 | git-diff-index --cached <tree-ish> |
| 710 | </dt> |
| 711 | <dd> |
| 712 | <p> |
| 713 | compares the <tree-ish> and the index. |
| 714 | </p> |
| 715 | </dd> |
| 716 | <dt> |
| 717 | git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>…] |
| 718 | </dt> |
| 719 | <dd> |
| 720 | <p> |
| 721 | compares the trees named by the two arguments. |
| 722 | </p> |
| 723 | </dd> |
| 724 | <dt> |
| 725 | git-diff-files [<pattern>…] |
| 726 | </dt> |
| 727 | <dd> |
| 728 | <p> |
| 729 | compares the index and the files on the filesystem. |
| 730 | </p> |
| 731 | </dd> |
| 732 | </dl> |
| 733 | <p>An output line is formatted this way:</p> |
| 734 | <div class="listingblock"> |
| 735 | <div class="content"> |
| 736 | <pre><tt>in-place edit :100644 100644 bcd1234... 0123456... M file0 |
| 737 | copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2 |
| 738 | rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3 |
| 739 | create :000000 100644 0000000... 1234567... A file4 |
| 740 | delete :100644 000000 1234567... 0000000... D file5 |
| 741 | unmerged :000000 000000 0000000... 0000000... U file6</tt></pre> |
| 742 | </div></div> |
| 743 | <p>That is, from the left to the right:</p> |
| 744 | <ol> |
| 745 | <li> |
| 746 | <p> |
| 747 | a colon. |
| 748 | </p> |
| 749 | </li> |
| 750 | <li> |
| 751 | <p> |
| 752 | mode for "src"; 000000 if creation or unmerged. |
| 753 | </p> |
| 754 | </li> |
| 755 | <li> |
| 756 | <p> |
| 757 | a space. |
| 758 | </p> |
| 759 | </li> |
| 760 | <li> |
| 761 | <p> |
| 762 | mode for "dst"; 000000 if deletion or unmerged. |
| 763 | </p> |
| 764 | </li> |
| 765 | <li> |
| 766 | <p> |
| 767 | a space. |
| 768 | </p> |
| 769 | </li> |
| 770 | <li> |
| 771 | <p> |
| 772 | sha1 for "src"; 0{40} if creation or unmerged. |
| 773 | </p> |
| 774 | </li> |
| 775 | <li> |
| 776 | <p> |
| 777 | a space. |
| 778 | </p> |
| 779 | </li> |
| 780 | <li> |
| 781 | <p> |
| 782 | sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree". |
| 783 | </p> |
| 784 | </li> |
| 785 | <li> |
| 786 | <p> |
| 787 | a space. |
| 788 | </p> |
| 789 | </li> |
| 790 | <li> |
| 791 | <p> |
| 792 | status, followed by optional "score" number. |
| 793 | </p> |
| 794 | </li> |
| 795 | <li> |
| 796 | <p> |
| 797 | a tab or a NUL when <em>-z</em> option is used. |
| 798 | </p> |
| 799 | </li> |
| 800 | <li> |
| 801 | <p> |
| 802 | path for "src" |
| 803 | </p> |
| 804 | </li> |
| 805 | <li> |
| 806 | <p> |
| 807 | a tab or a NUL when <em>-z</em> option is used; only exists for C or R. |
| 808 | </p> |
| 809 | </li> |
| 810 | <li> |
| 811 | <p> |
| 812 | path for "dst"; only exists for C or R. |
| 813 | </p> |
| 814 | </li> |
| 815 | <li> |
| 816 | <p> |
| 817 | an LF or a NUL when <em>-z</em> option is used, to terminate the record. |
| 818 | </p> |
| 819 | </li> |
| 820 | </ol> |
| 821 | <p><sha1> is shown as all 0's if a file is new on the filesystem |
| 822 | and it is out of sync with the index.</p> |
| 823 | <p>Example:</p> |
| 824 | <div class="listingblock"> |
| 825 | <div class="content"> |
| 826 | <pre><tt>:100644 100644 5be4a4...... 000000...... M file.c</tt></pre> |
| 827 | </div></div> |
| 828 | <p>When <tt>-z</tt> option is not used, TAB, LF, and backslash characters |
| 829 | in pathnames are represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>, |
| 830 | respectively.</p> |
| 831 | </div> |
| 832 | <h2>Generating patches with -p</h2> |
| 833 | <div class="sectionbody"> |
| 834 | <p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run |
| 835 | with a <em>-p</em> option, they do not produce the output described above; |
| 836 | instead they produce a patch file.</p> |
| 837 | <p>The patch generation can be customized at two levels.</p> |
| 838 | <ol> |
| 839 | <li> |
| 840 | <p> |
| 841 | When the environment variable <em>GIT_EXTERNAL_DIFF</em> is not set, |
| 842 | these commands internally invoke "diff" like this: |
| 843 | </p> |
| 844 | <div class="literalblock"> |
| 845 | <div class="content"> |
| 846 | <pre><tt>diff -L a/<path> -L b/<path> -pu <old> <new></tt></pre> |
| 847 | </div></div> |
| 848 | <p>For added files, <tt>/dev/null</tt> is used for <old>. For removed |
| 849 | files, <tt>/dev/null</tt> is used for <new></p> |
| 850 | <p>The "diff" formatting options can be customized via the |
| 851 | environment variable <em>GIT_DIFF_OPTS</em>. For example, if you |
| 852 | prefer context diff:</p> |
| 853 | <div class="literalblock"> |
| 854 | <div class="content"> |
| 855 | <pre><tt>GIT_DIFF_OPTS=-c git-diff-index -p HEAD</tt></pre> |
| 856 | </div></div> |
| 857 | </li> |
| 858 | <li> |
| 859 | <p> |
| 860 | When the environment variable <em>GIT_EXTERNAL_DIFF</em> is set, the |
| 861 | program named by it is called, instead of the diff invocation |
| 862 | described above. |
| 863 | </p> |
| 864 | <p>For a path that is added, removed, or modified, |
| 865 | <em>GIT_EXTERNAL_DIFF</em> is called with 7 parameters:</p> |
| 866 | <div class="literalblock"> |
| 867 | <div class="content"> |
| 868 | <pre><tt>path old-file old-hex old-mode new-file new-hex new-mode</tt></pre> |
| 869 | </div></div> |
| 870 | <p>where:</p> |
| 871 | <div class="hlist"><table> |
| 872 | <tr> |
| 873 | <td class="hlist1"> |
| 874 | <old|new>-file |
| 875 | </td> |
| 876 | <td class="hlist2"> |
| 877 | are files GIT_EXTERNAL_DIFF can use to read the |
| 878 | contents of <old|new>, |
| 879 | </td> |
| 880 | </tr> |
| 881 | <tr> |
| 882 | <td class="hlist1"> |
| 883 | <old|new>-hex |
| 884 | </td> |
| 885 | <td class="hlist2"> |
| 886 | are the 40-hexdigit SHA1 hashes, |
| 887 | </td> |
| 888 | </tr> |
| 889 | <tr> |
| 890 | <td class="hlist1"> |
| 891 | <old|new>-mode |
| 892 | </td> |
| 893 | <td class="hlist2"> |
| 894 | are the octal representation of the file modes. |
| 895 | </td> |
| 896 | </tr> |
| 897 | </table></div> |
| 898 | <p>The file parameters can point at the user's working file |
| 899 | (e.g. <tt>new-file</tt> in "git-diff-files"), <tt>/dev/null</tt> (e.g. <tt>old-file</tt> |
| 900 | when a new file is added), or a temporary file (e.g. <tt>old-file</tt> in the |
| 901 | index). <em>GIT_EXTERNAL_DIFF</em> should not worry about unlinking the |
| 902 | temporary file --- it is removed when <em>GIT_EXTERNAL_DIFF</em> exits.</p> |
| 903 | </li> |
| 904 | </ol> |
| 905 | <p>For a path that is unmerged, <em>GIT_EXTERNAL_DIFF</em> is called with 1 |
| 906 | parameter, <path>.</p> |
| 907 | </div> |
| 908 | <h2>git specific extension to diff format</h2> |
| 909 | <div class="sectionbody"> |
| 910 | <p>What -p option produces is slightly different from the |
| 911 | traditional diff format.</p> |
| 912 | <ol> |
| 913 | <li> |
| 914 | <p> |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 915 | It is preceded with a "git diff" header, that looks like |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 916 | this: |
| 917 | </p> |
| 918 | <div class="literalblock"> |
| 919 | <div class="content"> |
| 920 | <pre><tt>diff --git a/file1 b/file2</tt></pre> |
| 921 | </div></div> |
| 922 | <p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is |
| 923 | involved. Especially, even for a creation or a deletion, |
| 924 | <tt>/dev/null</tt> is _not_ used in place of <tt>a/</tt> or <tt>b/</tt> filenames.</p> |
| 925 | <p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the |
| 926 | name of the source file of the rename/copy and the name of |
| 927 | the file that rename/copy produces, respectively.</p> |
| 928 | </li> |
| 929 | <li> |
| 930 | <p> |
| 931 | It is followed by one or more extended header lines: |
| 932 | </p> |
| 933 | <div class="literalblock"> |
| 934 | <div class="content"> |
| 935 | <pre><tt>old mode <mode> |
| 936 | new mode <mode> |
| 937 | deleted file mode <mode> |
| 938 | new file mode <mode> |
| 939 | copy from <path> |
| 940 | copy to <path> |
| 941 | rename from <path> |
| 942 | rename to <path> |
| 943 | similarity index <number> |
| 944 | dissimilarity index <number> |
| 945 | index <hash>..<hash> <mode></tt></pre> |
| 946 | </div></div> |
| 947 | </li> |
| 948 | <li> |
| 949 | <p> |
| 950 | TAB, LF, and backslash characters in pathnames are |
| 951 | represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>, respectively. |
| 952 | </p> |
| 953 | </li> |
| 954 | </ol> |
| 955 | </div> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 956 | <h2>combined diff format</h2> |
| 957 | <div class="sectionbody"> |
| 958 | <p>git-diff-tree and git-diff-files can take <em>-c</em> or <em>--cc</em> option |
| 959 | to produce <em>combined diff</em>, which looks like this:</p> |
| 960 | <div class="listingblock"> |
| 961 | <div class="content"> |
| 962 | <pre><tt>diff --combined describe.c |
| 963 | @@@ +98,7 @@@ |
| 964 | return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1; |
| 965 | } |
| 966 | |
| 967 | - static void describe(char *arg) |
| 968 | -static void describe(struct commit *cmit, int last_one) |
| 969 | ++static void describe(char *arg, int last_one) |
| 970 | { |
| 971 | + unsigned char sha1[20]; |
| 972 | + struct commit *cmit;</tt></pre> |
| 973 | </div></div> |
| 974 | <p>Unlike the traditional <em>unified</em> diff format, which shows two |
| 975 | files A and B with a single column that has <tt>-</tt> (minus — |
| 976 | appears in A but removed in B), <tt>+</tt> (plus — missing in A but |
| 977 | added to B), or <tt> </tt> (space — unchanged) prefix, this format |
| 978 | compares two or more files file1, file2,… with one file X, and |
| 979 | shows how X differs from each of fileN. One column for each of |
| 980 | fileN is prepended to the output line to note how X's line is |
| 981 | different from it.</p> |
| 982 | <p>A <tt>-</tt> character in the column N means that the line appears in |
| 983 | fileN but it does not appear in the last file. A <tt>+</tt> character |
| 984 | in the column N means that the line appears in the last file, |
| 985 | and fileN does not have that line.</p> |
| 986 | <p>In the above example output, the function signature was changed |
| 987 | from both files (hence two <tt>-</tt> removals from both file1 and |
| 988 | file2, plus <tt>++</tt> to mean one line that was added does not appear |
| 989 | in either file1 nor file2). Also two other lines are the same |
| 990 | from file1 but do not appear in file2 (hence prefixed with <tt> +</tt>).</p> |
| 991 | <p>When shown by <tt>git diff-tree -c</tt>, it compares the parents of a |
| 992 | merge commit with the merge result (i.e. file1..fileN are the |
| 993 | parents). When shown by <tt>git diff-files -c</tt>, it compares the |
| 994 | two unresolved merge parents with the working tree file |
| 995 | (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka |
| 996 | "their version").</p> |
| 997 | </div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 998 | <h2>Author</h2> |
| 999 | <div class="sectionbody"> |
| 1000 | <p>Written by Linus Torvalds <torvalds@osdl.org></p> |
| 1001 | </div> |
| 1002 | <h2>Documentation</h2> |
| 1003 | <div class="sectionbody"> |
| 1004 | <p>Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.</p> |
| 1005 | </div> |
| 1006 | <h2>GIT</h2> |
| 1007 | <div class="sectionbody"> |
| 1008 | <p>Part of the <a href="git.html">git(7)</a> suite</p> |
| 1009 | </div> |
| 1010 | <div id="footer"> |
| 1011 | <div id="footer-text"> |
Junio C Hamano | 6959c6c | 2006-05-17 10:34:11 | [diff] [blame] | 1012 | Last updated 17-May-2006 10:34:02 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1013 | </div> |
| 1014 | </div> |
| 1015 | </body> |
| 1016 | </html> |