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 | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 307 | --raw |
| 308 | </dt> |
| 309 | <dd> |
| 310 | <p> |
| 311 | Generate the raw format. |
| 312 | </p> |
| 313 | </dd> |
| 314 | <dt> |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 315 | --patch-with-raw |
| 316 | </dt> |
| 317 | <dd> |
| 318 | <p> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 319 | Synonym for "-p --raw". |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 320 | </p> |
| 321 | </dd> |
| 322 | <dt> |
Junio C Hamano | 4a9a76a | 2006-10-01 05:40:29 | [diff] [blame] | 323 | --stat[=width[,name-width]] |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 324 | </dt> |
| 325 | <dd> |
| 326 | <p> |
Junio C Hamano | 4a9a76a | 2006-10-01 05:40:29 | [diff] [blame] | 327 | Generate a diffstat. You can override the default |
| 328 | output width for 80-column terminal by "--stat=width". |
| 329 | The width of the filename part can be controlled by |
| 330 | giving another width to it separated by a comma. |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 331 | </p> |
| 332 | </dd> |
| 333 | <dt> |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 334 | --numstat |
| 335 | </dt> |
| 336 | <dd> |
| 337 | <p> |
| 338 | Similar to --stat, but shows number of added and |
| 339 | deleted lines in decimal notation and pathname without |
Junio C Hamano | d793de5 | 2006-12-26 09:11:43 | [diff] [blame] | 340 | abbreviation, to make it more machine friendly. For |
| 341 | binary files, outputs two <tt>-</tt> instead of saying |
| 342 | <tt>0 0</tt>. |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 343 | </p> |
| 344 | </dd> |
| 345 | <dt> |
Junio C Hamano | 7d23f5e | 2006-12-16 07:44:04 | [diff] [blame] | 346 | --shortstat |
| 347 | </dt> |
| 348 | <dd> |
| 349 | <p> |
| 350 | Output only the last line of the --stat format containing total |
| 351 | number of modified files, as well as number of added and deleted |
| 352 | lines. |
| 353 | </p> |
| 354 | </dd> |
| 355 | <dt> |
Junio C Hamano | 6959c6c | 2006-05-17 10:34:11 | [diff] [blame] | 356 | --summary |
| 357 | </dt> |
| 358 | <dd> |
| 359 | <p> |
| 360 | Output a condensed summary of extended header information |
| 361 | such as creations, renames and mode changes. |
| 362 | </p> |
| 363 | </dd> |
| 364 | <dt> |
Junio C Hamano | d1308c9 | 2006-04-16 11:01:09 | [diff] [blame] | 365 | --patch-with-stat |
| 366 | </dt> |
| 367 | <dd> |
| 368 | <p> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 369 | Synonym for "-p --stat". |
Junio C Hamano | d1308c9 | 2006-04-16 11:01:09 | [diff] [blame] | 370 | </p> |
| 371 | </dd> |
| 372 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 373 | -z |
| 374 | </dt> |
| 375 | <dd> |
| 376 | <p> |
| 377 | \0 line termination on output |
| 378 | </p> |
| 379 | </dd> |
| 380 | <dt> |
| 381 | --name-only |
| 382 | </dt> |
| 383 | <dd> |
| 384 | <p> |
| 385 | Show only names of changed files. |
| 386 | </p> |
| 387 | </dd> |
| 388 | <dt> |
| 389 | --name-status |
| 390 | </dt> |
| 391 | <dd> |
| 392 | <p> |
| 393 | Show only names and status of changed files. |
| 394 | </p> |
| 395 | </dd> |
| 396 | <dt> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 397 | --color |
| 398 | </dt> |
| 399 | <dd> |
| 400 | <p> |
| 401 | Show colored diff. |
| 402 | </p> |
| 403 | </dd> |
| 404 | <dt> |
| 405 | --no-color |
| 406 | </dt> |
| 407 | <dd> |
| 408 | <p> |
| 409 | Turn off colored diff, even when the configuration file |
| 410 | gives the default to color output. |
| 411 | </p> |
| 412 | </dd> |
| 413 | <dt> |
Junio C Hamano | 85e45fa | 2006-08-13 07:47:41 | [diff] [blame] | 414 | --color-words |
| 415 | </dt> |
| 416 | <dd> |
| 417 | <p> |
| 418 | Show colored word diff, i.e. color words which have changed. |
| 419 | </p> |
| 420 | </dd> |
| 421 | <dt> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 422 | --no-renames |
| 423 | </dt> |
| 424 | <dd> |
| 425 | <p> |
| 426 | Turn off rename detection, even when the configuration |
| 427 | file gives the default to do so. |
| 428 | </p> |
| 429 | </dd> |
| 430 | <dt> |
Junio C Hamano | a890c4f | 2007-01-28 10:29:21 | [diff] [blame] | 431 | --check |
| 432 | </dt> |
| 433 | <dd> |
| 434 | <p> |
| 435 | Warn if changes introduce trailing whitespace |
| 436 | or an indent that uses a space before a tab. |
| 437 | </p> |
| 438 | </dd> |
| 439 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 440 | --full-index |
| 441 | </dt> |
| 442 | <dd> |
| 443 | <p> |
| 444 | Instead of the first handful characters, show full |
| 445 | object name of pre- and post-image blob on the "index" |
| 446 | line when generating a patch format output. |
| 447 | </p> |
| 448 | </dd> |
| 449 | <dt> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 450 | --binary |
| 451 | </dt> |
| 452 | <dd> |
| 453 | <p> |
| 454 | In addition to --full-index, output "binary diff" that |
| 455 | can be applied with "git apply". |
| 456 | </p> |
| 457 | </dd> |
| 458 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 459 | --abbrev[=<n>] |
| 460 | </dt> |
| 461 | <dd> |
| 462 | <p> |
| 463 | Instead of showing the full 40-byte hexadecimal object |
| 464 | name in diff-raw format output and diff-tree header |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 465 | lines, show only handful hexdigits prefix. This is |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 466 | independent of --full-index option above, which controls |
| 467 | the diff-patch output format. Non default number of |
| 468 | digits can be specified with --abbrev=<n>. |
| 469 | </p> |
| 470 | </dd> |
| 471 | <dt> |
| 472 | -B |
| 473 | </dt> |
| 474 | <dd> |
| 475 | <p> |
| 476 | Break complete rewrite changes into pairs of delete and create. |
| 477 | </p> |
| 478 | </dd> |
| 479 | <dt> |
| 480 | -M |
| 481 | </dt> |
| 482 | <dd> |
| 483 | <p> |
| 484 | Detect renames. |
| 485 | </p> |
| 486 | </dd> |
| 487 | <dt> |
| 488 | -C |
| 489 | </dt> |
| 490 | <dd> |
| 491 | <p> |
| 492 | Detect copies as well as renames. |
| 493 | </p> |
| 494 | </dd> |
| 495 | <dt> |
Junio C Hamano | 6ec31b9 | 2006-02-10 05:52:01 | [diff] [blame] | 496 | --diff-filter=[ACDMRTUXB*] |
| 497 | </dt> |
| 498 | <dd> |
| 499 | <p> |
| 500 | Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>), |
| 501 | Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their |
| 502 | type (mode) changed (<tt>T</tt>), are Unmerged (<tt>U</tt>), are |
| 503 | Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>). |
| 504 | Any combination of the filter characters may be used. |
| 505 | When <tt>*</tt> (All-or-none) is added to the combination, all |
| 506 | paths are selected if there is any file that matches |
| 507 | other criteria in the comparison; if there is no file |
| 508 | that matches other criteria, nothing is selected. |
| 509 | </p> |
| 510 | </dd> |
| 511 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 512 | --find-copies-harder |
| 513 | </dt> |
| 514 | <dd> |
| 515 | <p> |
| 516 | For performance reasons, by default, -C option finds copies only |
| 517 | if the original file of the copy was modified in the same |
| 518 | changeset. This flag makes the command |
| 519 | inspect unmodified files as candidates for the source of |
| 520 | copy. This is a very expensive operation for large |
| 521 | projects, so use it with caution. |
| 522 | </p> |
| 523 | </dd> |
| 524 | <dt> |
| 525 | -l<num> |
| 526 | </dt> |
| 527 | <dd> |
| 528 | <p> |
| 529 | -M and -C options require O(n^2) processing time where n |
| 530 | is the number of potential rename/copy targets. This |
| 531 | option prevents rename/copy detection from running if |
| 532 | the number of rename/copy targets exceeds the specified |
| 533 | number. |
| 534 | </p> |
| 535 | </dd> |
| 536 | <dt> |
| 537 | -S<string> |
| 538 | </dt> |
| 539 | <dd> |
| 540 | <p> |
| 541 | Look for differences that contain the change in <string>. |
| 542 | </p> |
| 543 | </dd> |
| 544 | <dt> |
| 545 | --pickaxe-all |
| 546 | </dt> |
| 547 | <dd> |
| 548 | <p> |
| 549 | When -S finds a change, show all the changes in that |
| 550 | changeset, not just the files that contain the change |
| 551 | in <string>. |
| 552 | </p> |
| 553 | </dd> |
| 554 | <dt> |
Junio C Hamano | bfe9e75 | 2006-04-05 21:43:28 | [diff] [blame] | 555 | --pickaxe-regex |
| 556 | </dt> |
| 557 | <dd> |
| 558 | <p> |
| 559 | Make the <string> not a plain string but an extended POSIX |
| 560 | regex to match. |
| 561 | </p> |
| 562 | </dd> |
| 563 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 564 | -O<orderfile> |
| 565 | </dt> |
| 566 | <dd> |
| 567 | <p> |
| 568 | Output the patch in the order specified in the |
| 569 | <orderfile>, which has one shell glob pattern per line. |
| 570 | </p> |
| 571 | </dd> |
| 572 | <dt> |
| 573 | -R |
| 574 | </dt> |
| 575 | <dd> |
| 576 | <p> |
| 577 | Swap two inputs; that is, show differences from index or |
| 578 | on-disk file to tree contents. |
| 579 | </p> |
| 580 | </dd> |
Junio C Hamano | c26f548 | 2006-07-09 09:38:14 | [diff] [blame] | 581 | <dt> |
| 582 | --text |
| 583 | </dt> |
| 584 | <dd> |
| 585 | <p> |
| 586 | Treat all files as text. |
| 587 | </p> |
| 588 | </dd> |
| 589 | <dt> |
| 590 | -a |
| 591 | </dt> |
| 592 | <dd> |
| 593 | <p> |
| 594 | Shorthand for "--text". |
| 595 | </p> |
| 596 | </dd> |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 597 | <dt> |
Junio C Hamano | fd46896 | 2007-02-14 23:45:04 | [diff] [blame] | 598 | --ignore-space-at-eol |
| 599 | </dt> |
| 600 | <dd> |
| 601 | <p> |
| 602 | Ignore changes in white spaces at EOL. |
| 603 | </p> |
| 604 | </dd> |
| 605 | <dt> |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 606 | --ignore-space-change |
| 607 | </dt> |
| 608 | <dd> |
| 609 | <p> |
| 610 | Ignore changes in amount of white space. This ignores white |
| 611 | space at line end, and consider all other sequences of one or |
| 612 | more white space characters to be equivalent. |
| 613 | </p> |
| 614 | </dd> |
| 615 | <dt> |
| 616 | -b |
| 617 | </dt> |
| 618 | <dd> |
| 619 | <p> |
| 620 | Shorthand for "--ignore-space-change". |
| 621 | </p> |
| 622 | </dd> |
| 623 | <dt> |
| 624 | --ignore-all-space |
| 625 | </dt> |
| 626 | <dd> |
| 627 | <p> |
| 628 | Ignore white space when comparing lines. This ignores |
| 629 | difference even if one line has white space where the other |
| 630 | line has none. |
| 631 | </p> |
| 632 | </dd> |
| 633 | <dt> |
| 634 | -w |
| 635 | </dt> |
| 636 | <dd> |
| 637 | <p> |
| 638 | Shorthand for "--ignore-all-space". |
| 639 | </p> |
| 640 | </dd> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 641 | </dl> |
| 642 | <p>For more detailed explanation on these common options, see also |
| 643 | <a href="diffcore.html">diffcore documentation</a>.</p> |
| 644 | <dl> |
| 645 | <dt> |
| 646 | <tree-ish> |
| 647 | </dt> |
| 648 | <dd> |
| 649 | <p> |
| 650 | The id of a tree object. |
| 651 | </p> |
| 652 | </dd> |
| 653 | <dt> |
| 654 | <path>… |
| 655 | </dt> |
| 656 | <dd> |
| 657 | <p> |
| 658 | If provided, the results are limited to a subset of files |
| 659 | matching one of these prefix strings. |
Junio C Hamano | 341071d | 2006-06-04 07:24:48 | [diff] [blame] | 660 | i.e., file matches <tt>/^<pattern1>|<pattern2>|…/</tt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 661 | Note that this parameter does not provide any wildcard or regexp |
| 662 | features. |
| 663 | </p> |
| 664 | </dd> |
| 665 | <dt> |
| 666 | -r |
| 667 | </dt> |
| 668 | <dd> |
| 669 | <p> |
| 670 | recurse into sub-trees |
| 671 | </p> |
| 672 | </dd> |
| 673 | <dt> |
| 674 | -t |
| 675 | </dt> |
| 676 | <dd> |
| 677 | <p> |
| 678 | show tree entry itself as well as subtrees. Implies -r. |
| 679 | </p> |
| 680 | </dd> |
| 681 | <dt> |
| 682 | --root |
| 683 | </dt> |
| 684 | <dd> |
| 685 | <p> |
| 686 | When <em>--root</em> is specified the initial commit will be showed as a big |
| 687 | creation event. This is equivalent to a diff against the NULL tree. |
| 688 | </p> |
| 689 | </dd> |
| 690 | <dt> |
| 691 | --stdin |
| 692 | </dt> |
| 693 | <dd> |
| 694 | <p> |
| 695 | When <em>--stdin</em> is specified, the command does not take |
| 696 | <tree-ish> arguments from the command line. Instead, it |
| 697 | reads either one <commit> or a pair of <tree-ish> |
| 698 | separated with a single space from its standard input. |
| 699 | </p> |
| 700 | <p>When a single commit is given on one line of such input, it compares |
| 701 | the commit with its parents. The following flags further affects its |
Junio C Hamano | 341071d | 2006-06-04 07:24:48 | [diff] [blame] | 702 | behavior. This does not apply to the case where two <tree-ish> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 703 | separated with a single space are given.</p> |
| 704 | </dd> |
| 705 | <dt> |
| 706 | -m |
| 707 | </dt> |
| 708 | <dd> |
| 709 | <p> |
| 710 | By default, "git-diff-tree --stdin" does not show |
| 711 | differences for merge commits. With this flag, it shows |
Junio C Hamano | a8adb1e | 2006-04-10 23:46:16 | [diff] [blame] | 712 | differences to that commit from all of its parents. See |
| 713 | also <em>-c</em>. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 714 | </p> |
| 715 | </dd> |
| 716 | <dt> |
| 717 | -s |
| 718 | </dt> |
| 719 | <dd> |
| 720 | <p> |
| 721 | By default, "git-diff-tree --stdin" shows differences, |
| 722 | either in machine-readable form (without <em>-p</em>) or in patch |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 723 | form (with <em>-p</em>). This output can be suppressed. It is |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 724 | only useful with <em>-v</em> flag. |
| 725 | </p> |
| 726 | </dd> |
| 727 | <dt> |
| 728 | -v |
| 729 | </dt> |
| 730 | <dd> |
| 731 | <p> |
| 732 | This flag causes "git-diff-tree --stdin" to also show |
| 733 | the commit message before the differences. |
| 734 | </p> |
| 735 | </dd> |
| 736 | <dt> |
Junio C Hamano | a340aaa | 2006-11-23 02:47:33 | [diff] [blame] | 737 | --pretty[=<em><format></em>] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 738 | </dt> |
| 739 | <dd> |
| 740 | <p> |
Junio C Hamano | a340aaa | 2006-11-23 02:47:33 | [diff] [blame] | 741 | Pretty-prints the details of a commit. <tt>--pretty</tt> |
| 742 | without an explicit <tt>=<format></tt> defaults to <em>medium</em>. |
| 743 | If the commit is a merge, and if the pretty-format |
| 744 | is not <em>oneline</em>, <em>email</em> or <em>raw</em>, an additional line is |
| 745 | inserted before the <em>Author:</em> line. This line begins with |
| 746 | "Merge: " and the sha1s of ancestral commits are printed, |
| 747 | separated by spaces. Note that the listed commits may not |
| 748 | necessarily be the list of the <strong>direct</strong> parent commits if you |
| 749 | have limited your view of history: for example, if you are |
| 750 | only interested in changes related to a certain directory or |
| 751 | file. Here are some additional details for each format: |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 752 | </p> |
Junio C Hamano | a340aaa | 2006-11-23 02:47:33 | [diff] [blame] | 753 | <ul> |
| 754 | <li> |
| 755 | <p> |
| 756 | <em>oneline</em> |
| 757 | </p> |
| 758 | <div class="literalblock"> |
| 759 | <div class="content"> |
| 760 | <pre><tt><sha1> <title line></tt></pre> |
| 761 | </div></div> |
| 762 | <p>This is designed to be as compact as possible.</p> |
| 763 | </li> |
| 764 | <li> |
| 765 | <p> |
| 766 | <em>short</em> |
| 767 | </p> |
| 768 | <div class="literalblock"> |
| 769 | <div class="content"> |
| 770 | <pre><tt>commit <sha1> |
| 771 | Author: <author></tt></pre> |
| 772 | </div></div> |
| 773 | <div class="literalblock"> |
| 774 | <div class="content"> |
| 775 | <pre><tt><title line></tt></pre> |
| 776 | </div></div> |
| 777 | </li> |
| 778 | <li> |
| 779 | <p> |
| 780 | <em>medium</em> |
| 781 | </p> |
| 782 | <div class="literalblock"> |
| 783 | <div class="content"> |
| 784 | <pre><tt>commit <sha1> |
| 785 | Author: <author> |
| 786 | Date: <date></tt></pre> |
| 787 | </div></div> |
| 788 | <div class="literalblock"> |
| 789 | <div class="content"> |
| 790 | <pre><tt><title line></tt></pre> |
| 791 | </div></div> |
| 792 | <div class="literalblock"> |
| 793 | <div class="content"> |
| 794 | <pre><tt><full commit message></tt></pre> |
| 795 | </div></div> |
| 796 | </li> |
| 797 | <li> |
| 798 | <p> |
| 799 | <em>full</em> |
| 800 | </p> |
| 801 | <div class="literalblock"> |
| 802 | <div class="content"> |
| 803 | <pre><tt>commit <sha1> |
| 804 | Author: <author> |
| 805 | Commit: <committer></tt></pre> |
| 806 | </div></div> |
| 807 | <div class="literalblock"> |
| 808 | <div class="content"> |
| 809 | <pre><tt><title line></tt></pre> |
| 810 | </div></div> |
| 811 | <div class="literalblock"> |
| 812 | <div class="content"> |
| 813 | <pre><tt><full commit message></tt></pre> |
| 814 | </div></div> |
| 815 | </li> |
| 816 | <li> |
| 817 | <p> |
| 818 | <em>fuller</em> |
| 819 | </p> |
| 820 | <div class="literalblock"> |
| 821 | <div class="content"> |
| 822 | <pre><tt>commit <sha1> |
| 823 | Author: <author> |
| 824 | AuthorDate: <date & time> |
| 825 | Commit: <committer> |
| 826 | CommitDate: <date & time></tt></pre> |
| 827 | </div></div> |
| 828 | <div class="literalblock"> |
| 829 | <div class="content"> |
| 830 | <pre><tt><title line></tt></pre> |
| 831 | </div></div> |
| 832 | <div class="literalblock"> |
| 833 | <div class="content"> |
| 834 | <pre><tt><full commit message></tt></pre> |
| 835 | </div></div> |
| 836 | </li> |
| 837 | <li> |
| 838 | <p> |
| 839 | <em>email</em> |
| 840 | </p> |
| 841 | <div class="literalblock"> |
| 842 | <div class="content"> |
| 843 | <pre><tt>From <sha1> <date> |
| 844 | From: <author> |
| 845 | Date: <date & time> |
| 846 | Subject: [PATCH] <title line></tt></pre> |
| 847 | </div></div> |
| 848 | <div class="literalblock"> |
| 849 | <div class="content"> |
| 850 | <pre><tt>full commit message></tt></pre> |
| 851 | </div></div> |
| 852 | </li> |
| 853 | <li> |
| 854 | <p> |
| 855 | <em>raw</em> |
| 856 | </p> |
| 857 | <p>The <em>raw</em> format shows the entire commit exactly as |
| 858 | stored in the commit object. Notably, the SHA1s are |
| 859 | displayed in full, regardless of whether --abbrev or |
| 860 | --no-abbrev are used, and <em>parents</em> information show the |
| 861 | true parent commits, without taking grafts nor history |
| 862 | simplification into account.</p> |
| 863 | </li> |
Junio C Hamano | a3fd83c | 2007-03-02 10:34:36 | [diff] [blame] | 864 | <li> |
| 865 | <p> |
| 866 | <em>format:</em> |
| 867 | </p> |
| 868 | <p>The <em>format:</em> format allows you to specify which information |
| 869 | you want to show. It works a little bit like printf format, |
| 870 | with the notable exception that you get a newline with <em>%n</em> |
| 871 | instead of <em>\n</em>.</p> |
| 872 | </li> |
Junio C Hamano | a340aaa | 2006-11-23 02:47:33 | [diff] [blame] | 873 | </ul> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 874 | </dd> |
Junio C Hamano | a3fd83c | 2007-03-02 10:34:36 | [diff] [blame] | 875 | </dl> |
| 876 | <p>E.g, <em>format:"The author of %h was %an, %ar%nThe title was >>%s<<"</em> |
| 877 | would show something like this:</p> |
| 878 | <p>The author of fe6e0ee was Junio C Hamano, 23 hours ago |
| 879 | The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<</p> |
| 880 | <p>The placeholders are:</p> |
| 881 | <ul> |
| 882 | <li> |
| 883 | <p> |
| 884 | <em>%H</em>: commit hash |
| 885 | </p> |
| 886 | </li> |
| 887 | <li> |
| 888 | <p> |
| 889 | <em>%h</em>: abbreviated commit hash |
| 890 | </p> |
| 891 | </li> |
| 892 | <li> |
| 893 | <p> |
| 894 | <em>%T</em>: tree hash |
| 895 | </p> |
| 896 | </li> |
| 897 | <li> |
| 898 | <p> |
| 899 | <em>%t</em>: abbreviated tree hash |
| 900 | </p> |
| 901 | </li> |
| 902 | <li> |
| 903 | <p> |
| 904 | <em>%P</em>: parent hashes |
| 905 | </p> |
| 906 | </li> |
| 907 | <li> |
| 908 | <p> |
| 909 | <em>%p</em>: abbreviated parent hashes |
| 910 | </p> |
| 911 | </li> |
| 912 | <li> |
| 913 | <p> |
| 914 | <em>%an</em>: author name |
| 915 | </p> |
| 916 | </li> |
| 917 | <li> |
| 918 | <p> |
| 919 | <em>%ae</em>: author email |
| 920 | </p> |
| 921 | </li> |
| 922 | <li> |
| 923 | <p> |
| 924 | <em>%ad</em>: author date |
| 925 | </p> |
| 926 | </li> |
| 927 | <li> |
| 928 | <p> |
| 929 | <em>%aD</em>: author date, RFC2822 style |
| 930 | </p> |
| 931 | </li> |
| 932 | <li> |
| 933 | <p> |
| 934 | <em>%ar</em>: author date, relative |
| 935 | </p> |
| 936 | </li> |
| 937 | <li> |
| 938 | <p> |
| 939 | <em>%at</em>: author date, UNIX timestamp |
| 940 | </p> |
| 941 | </li> |
| 942 | <li> |
| 943 | <p> |
| 944 | <em>%cn</em>: committer name |
| 945 | </p> |
| 946 | </li> |
| 947 | <li> |
| 948 | <p> |
| 949 | <em>%ce</em>: committer email |
| 950 | </p> |
| 951 | </li> |
| 952 | <li> |
| 953 | <p> |
| 954 | <em>%cd</em>: committer date |
| 955 | </p> |
| 956 | </li> |
| 957 | <li> |
| 958 | <p> |
| 959 | <em>%cD</em>: committer date, RFC2822 style |
| 960 | </p> |
| 961 | </li> |
| 962 | <li> |
| 963 | <p> |
| 964 | <em>%cr</em>: committer date, relative |
| 965 | </p> |
| 966 | </li> |
| 967 | <li> |
| 968 | <p> |
| 969 | <em>%ct</em>: committer date, UNIX timestamp |
| 970 | </p> |
| 971 | </li> |
| 972 | <li> |
| 973 | <p> |
| 974 | <em>%e</em>: encoding |
| 975 | </p> |
| 976 | </li> |
| 977 | <li> |
| 978 | <p> |
| 979 | <em>%s</em>: subject |
| 980 | </p> |
| 981 | </li> |
| 982 | <li> |
| 983 | <p> |
| 984 | <em>%b</em>: body |
| 985 | </p> |
| 986 | </li> |
| 987 | <li> |
| 988 | <p> |
| 989 | <em>%Cred</em>: switch color to red |
| 990 | </p> |
| 991 | </li> |
| 992 | <li> |
| 993 | <p> |
| 994 | <em>%Cgreen</em>: switch color to green |
| 995 | </p> |
| 996 | </li> |
| 997 | <li> |
| 998 | <p> |
| 999 | <em>%Cblue</em>: switch color to blue |
| 1000 | </p> |
| 1001 | </li> |
| 1002 | <li> |
| 1003 | <p> |
| 1004 | <em>%Creset</em>: reset color |
| 1005 | </p> |
| 1006 | </li> |
| 1007 | <li> |
| 1008 | <p> |
| 1009 | <em>%n</em>: newline |
| 1010 | </p> |
| 1011 | <dl> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1012 | <dt> |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 1013 | --encoding[=<encoding>] |
| 1014 | </dt> |
| 1015 | <dd> |
| 1016 | <p> |
| 1017 | The commit objects record the encoding used for the log message |
| 1018 | in their encoding header; this option can be used to tell the |
| 1019 | command to re-code the commit log message in the encoding |
| 1020 | preferred by the user. For non plumbing commands this |
| 1021 | defaults to UTF-8. |
| 1022 | </p> |
| 1023 | </dd> |
| 1024 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1025 | --no-commit-id |
| 1026 | </dt> |
| 1027 | <dd> |
| 1028 | <p> |
| 1029 | git-diff-tree outputs a line with the commit ID when |
| 1030 | applicable. This flag suppressed the commit ID output. |
| 1031 | </p> |
| 1032 | </dd> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1033 | <dt> |
Junio C Hamano | a8adb1e | 2006-04-10 23:46:16 | [diff] [blame] | 1034 | -c |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1035 | </dt> |
| 1036 | <dd> |
| 1037 | <p> |
Junio C Hamano | a8adb1e | 2006-04-10 23:46:16 | [diff] [blame] | 1038 | This flag changes the way a merge commit is displayed |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1039 | (which means it is useful only when the command is given |
| 1040 | one <tree-ish>, or <em>--stdin</em>). It shows the differences |
Junio C Hamano | a8adb1e | 2006-04-10 23:46:16 | [diff] [blame] | 1041 | from each of the parents to the merge result simultaneously |
| 1042 | instead of showing pairwise diff between a parent and the |
| 1043 | result one at a time (which is what the <em>-m</em> option does). |
| 1044 | Furthermore, it lists only files which were modified |
| 1045 | from all parents. |
| 1046 | </p> |
| 1047 | </dd> |
| 1048 | <dt> |
Junio C Hamano | 46338f5 | 2006-05-04 00:46:44 | [diff] [blame] | 1049 | --cc |
Junio C Hamano | a8adb1e | 2006-04-10 23:46:16 | [diff] [blame] | 1050 | </dt> |
| 1051 | <dd> |
| 1052 | <p> |
| 1053 | This flag changes the way a merge commit patch is displayed, |
| 1054 | in a similar way to the <em>-c</em> option. It implies the <em>-c</em> |
| 1055 | and <em>-p</em> options and further compresses the patch output |
| 1056 | by omitting hunks that show differences from only one |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1057 | parent, or show the same change from all but one parent |
| 1058 | for an Octopus merge. When this optimization makes all |
| 1059 | hunks disappear, the commit itself and the commit log |
Junio C Hamano | a8adb1e | 2006-04-10 23:46:16 | [diff] [blame] | 1060 | message is not shown, just like in any other "empty diff" case. |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1061 | </p> |
| 1062 | </dd> |
Junio C Hamano | d9d71c0 | 2006-02-08 00:52:33 | [diff] [blame] | 1063 | <dt> |
| 1064 | --always |
| 1065 | </dt> |
| 1066 | <dd> |
| 1067 | <p> |
| 1068 | Show the commit itself and the commit log message even |
| 1069 | if the diff itself is empty. |
| 1070 | </p> |
| 1071 | </dd> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1072 | </dl> |
Junio C Hamano | a3fd83c | 2007-03-02 10:34:36 | [diff] [blame] | 1073 | </li> |
| 1074 | </ul> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1075 | </div> |
| 1076 | <h2>Limiting Output</h2> |
| 1077 | <div class="sectionbody"> |
| 1078 | <p>If you're only interested in differences in a subset of files, for |
| 1079 | example some architecture-specific files, you might do:</p> |
| 1080 | <div class="literalblock"> |
| 1081 | <div class="content"> |
| 1082 | <pre><tt>git-diff-tree -r <tree-ish> <tree-ish> arch/ia64 include/asm-ia64</tt></pre> |
| 1083 | </div></div> |
| 1084 | <p>and it will only show you what changed in those two directories.</p> |
| 1085 | <p>Or if you are searching for what changed in just <tt>kernel/sched.c</tt>, just do</p> |
| 1086 | <div class="literalblock"> |
| 1087 | <div class="content"> |
| 1088 | <pre><tt>git-diff-tree -r <tree-ish> <tree-ish> kernel/sched.c</tt></pre> |
| 1089 | </div></div> |
| 1090 | <p>and it will ignore all differences to other files.</p> |
| 1091 | <p>The pattern is always the prefix, and is matched exactly. There are no |
| 1092 | wildcards. Even stricter, it has to match a complete path component. |
| 1093 | I.e. "foo" does not pick up <tt>foobar.h</tt>. "foo" does match <tt>foo/bar.h</tt> |
| 1094 | so it can be used to name subdirectories.</p> |
| 1095 | <p>An example of normal usage is:</p> |
| 1096 | <div class="literalblock"> |
| 1097 | <div class="content"> |
| 1098 | <pre><tt>torvalds@ppc970:~/git> git-diff-tree 5319e4...... |
| 1099 | *100664->100664 blob ac348b.......->a01513....... git-fsck-objects.c</tt></pre> |
| 1100 | </div></div> |
| 1101 | <p>which tells you that the last commit changed just one file (it's from |
| 1102 | this one:</p> |
| 1103 | <div class="listingblock"> |
| 1104 | <div class="content"> |
| 1105 | <pre><tt>commit 3c6f7ca19ad4043e9e72fa94106f352897e651a8 |
| 1106 | tree 5319e4d609cdd282069cc4dce33c1db559539b03 |
| 1107 | parent b4e628ea30d5ab3606119d2ea5caeab141d38df7 |
| 1108 | author Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005 |
| 1109 | committer Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005 |
| 1110 | |
| 1111 | Make "git-fsck-objects" print out all the root commits it finds. |
| 1112 | |
| 1113 | Once I do the reference tracking, I'll also make it print out all the |
| 1114 | HEAD commits it finds, which is even more interesting.</tt></pre> |
| 1115 | </div></div> |
| 1116 | <p>in case you care).</p> |
| 1117 | </div> |
| 1118 | <h2>Output format</h2> |
| 1119 | <div class="sectionbody"> |
| 1120 | <p>The output format from "git-diff-index", "git-diff-tree" and |
| 1121 | "git-diff-files" are very similar.</p> |
| 1122 | <p>These commands all compare two sets of things; what is |
| 1123 | compared differs:</p> |
| 1124 | <dl> |
| 1125 | <dt> |
| 1126 | git-diff-index <tree-ish> |
| 1127 | </dt> |
| 1128 | <dd> |
| 1129 | <p> |
| 1130 | compares the <tree-ish> and the files on the filesystem. |
| 1131 | </p> |
| 1132 | </dd> |
| 1133 | <dt> |
| 1134 | git-diff-index --cached <tree-ish> |
| 1135 | </dt> |
| 1136 | <dd> |
| 1137 | <p> |
| 1138 | compares the <tree-ish> and the index. |
| 1139 | </p> |
| 1140 | </dd> |
| 1141 | <dt> |
| 1142 | git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>…] |
| 1143 | </dt> |
| 1144 | <dd> |
| 1145 | <p> |
| 1146 | compares the trees named by the two arguments. |
| 1147 | </p> |
| 1148 | </dd> |
| 1149 | <dt> |
| 1150 | git-diff-files [<pattern>…] |
| 1151 | </dt> |
| 1152 | <dd> |
| 1153 | <p> |
| 1154 | compares the index and the files on the filesystem. |
| 1155 | </p> |
| 1156 | </dd> |
| 1157 | </dl> |
| 1158 | <p>An output line is formatted this way:</p> |
| 1159 | <div class="listingblock"> |
| 1160 | <div class="content"> |
| 1161 | <pre><tt>in-place edit :100644 100644 bcd1234... 0123456... M file0 |
| 1162 | copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2 |
| 1163 | rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3 |
| 1164 | create :000000 100644 0000000... 1234567... A file4 |
| 1165 | delete :100644 000000 1234567... 0000000... D file5 |
| 1166 | unmerged :000000 000000 0000000... 0000000... U file6</tt></pre> |
| 1167 | </div></div> |
| 1168 | <p>That is, from the left to the right:</p> |
| 1169 | <ol> |
| 1170 | <li> |
| 1171 | <p> |
| 1172 | a colon. |
| 1173 | </p> |
| 1174 | </li> |
| 1175 | <li> |
| 1176 | <p> |
| 1177 | mode for "src"; 000000 if creation or unmerged. |
| 1178 | </p> |
| 1179 | </li> |
| 1180 | <li> |
| 1181 | <p> |
| 1182 | a space. |
| 1183 | </p> |
| 1184 | </li> |
| 1185 | <li> |
| 1186 | <p> |
| 1187 | mode for "dst"; 000000 if deletion or unmerged. |
| 1188 | </p> |
| 1189 | </li> |
| 1190 | <li> |
| 1191 | <p> |
| 1192 | a space. |
| 1193 | </p> |
| 1194 | </li> |
| 1195 | <li> |
| 1196 | <p> |
| 1197 | sha1 for "src"; 0{40} if creation or unmerged. |
| 1198 | </p> |
| 1199 | </li> |
| 1200 | <li> |
| 1201 | <p> |
| 1202 | a space. |
| 1203 | </p> |
| 1204 | </li> |
| 1205 | <li> |
| 1206 | <p> |
| 1207 | sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree". |
| 1208 | </p> |
| 1209 | </li> |
| 1210 | <li> |
| 1211 | <p> |
| 1212 | a space. |
| 1213 | </p> |
| 1214 | </li> |
| 1215 | <li> |
| 1216 | <p> |
| 1217 | status, followed by optional "score" number. |
| 1218 | </p> |
| 1219 | </li> |
| 1220 | <li> |
| 1221 | <p> |
| 1222 | a tab or a NUL when <em>-z</em> option is used. |
| 1223 | </p> |
| 1224 | </li> |
| 1225 | <li> |
| 1226 | <p> |
| 1227 | path for "src" |
| 1228 | </p> |
| 1229 | </li> |
| 1230 | <li> |
| 1231 | <p> |
| 1232 | a tab or a NUL when <em>-z</em> option is used; only exists for C or R. |
| 1233 | </p> |
| 1234 | </li> |
| 1235 | <li> |
| 1236 | <p> |
| 1237 | path for "dst"; only exists for C or R. |
| 1238 | </p> |
| 1239 | </li> |
| 1240 | <li> |
| 1241 | <p> |
| 1242 | an LF or a NUL when <em>-z</em> option is used, to terminate the record. |
| 1243 | </p> |
| 1244 | </li> |
| 1245 | </ol> |
| 1246 | <p><sha1> is shown as all 0's if a file is new on the filesystem |
| 1247 | and it is out of sync with the index.</p> |
| 1248 | <p>Example:</p> |
| 1249 | <div class="listingblock"> |
| 1250 | <div class="content"> |
| 1251 | <pre><tt>:100644 100644 5be4a4...... 000000...... M file.c</tt></pre> |
| 1252 | </div></div> |
| 1253 | <p>When <tt>-z</tt> option is not used, TAB, LF, and backslash characters |
| 1254 | in pathnames are represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>, |
| 1255 | respectively.</p> |
| 1256 | </div> |
| 1257 | <h2>Generating patches with -p</h2> |
| 1258 | <div class="sectionbody"> |
| 1259 | <p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run |
| 1260 | with a <em>-p</em> option, they do not produce the output described above; |
Junio C Hamano | 1c43712 | 2006-11-28 02:22:25 | [diff] [blame] | 1261 | instead they produce a patch file. You can customize the creation |
| 1262 | of such patches via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS |
| 1263 | environment variables.</p> |
| 1264 | <p>What the -p option produces is slightly different from the traditional |
| 1265 | diff format.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1266 | <ol> |
| 1267 | <li> |
| 1268 | <p> |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 1269 | It is preceded with a "git diff" header, that looks like |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1270 | this: |
| 1271 | </p> |
| 1272 | <div class="literalblock"> |
| 1273 | <div class="content"> |
| 1274 | <pre><tt>diff --git a/file1 b/file2</tt></pre> |
| 1275 | </div></div> |
| 1276 | <p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is |
| 1277 | involved. Especially, even for a creation or a deletion, |
| 1278 | <tt>/dev/null</tt> is _not_ used in place of <tt>a/</tt> or <tt>b/</tt> filenames.</p> |
| 1279 | <p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the |
| 1280 | name of the source file of the rename/copy and the name of |
| 1281 | the file that rename/copy produces, respectively.</p> |
| 1282 | </li> |
| 1283 | <li> |
| 1284 | <p> |
| 1285 | It is followed by one or more extended header lines: |
| 1286 | </p> |
| 1287 | <div class="literalblock"> |
| 1288 | <div class="content"> |
| 1289 | <pre><tt>old mode <mode> |
| 1290 | new mode <mode> |
| 1291 | deleted file mode <mode> |
| 1292 | new file mode <mode> |
| 1293 | copy from <path> |
| 1294 | copy to <path> |
| 1295 | rename from <path> |
| 1296 | rename to <path> |
| 1297 | similarity index <number> |
| 1298 | dissimilarity index <number> |
| 1299 | index <hash>..<hash> <mode></tt></pre> |
| 1300 | </div></div> |
| 1301 | </li> |
| 1302 | <li> |
| 1303 | <p> |
Junio C Hamano | a053d54 | 2006-10-27 09:29:13 | [diff] [blame] | 1304 | TAB, LF, double quote and backslash characters in pathnames |
| 1305 | are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and <tt>\\</tt>, respectively. |
| 1306 | If there is need for such substitution then the whole |
| 1307 | pathname is put in double quotes. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1308 | </p> |
| 1309 | </li> |
| 1310 | </ol> |
| 1311 | </div> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1312 | <h2>combined diff format</h2> |
| 1313 | <div class="sectionbody"> |
| 1314 | <p>git-diff-tree and git-diff-files can take <em>-c</em> or <em>--cc</em> option |
| 1315 | to produce <em>combined diff</em>, which looks like this:</p> |
| 1316 | <div class="listingblock"> |
| 1317 | <div class="content"> |
| 1318 | <pre><tt>diff --combined describe.c |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 1319 | index fabadb8,cc95eb0..4866510 |
| 1320 | --- a/describe.c |
| 1321 | +++ b/describe.c |
| 1322 | @@@ -98,20 -98,12 +98,20 @@@ |
| 1323 | return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1; |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1324 | } |
| 1325 | |
| 1326 | - static void describe(char *arg) |
| 1327 | -static void describe(struct commit *cmit, int last_one) |
| 1328 | ++static void describe(char *arg, int last_one) |
| 1329 | { |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 1330 | + unsigned char sha1[20]; |
| 1331 | + struct commit *cmit; |
| 1332 | struct commit_list *list; |
| 1333 | static int initialized = 0; |
| 1334 | struct commit_name *n; |
| 1335 | |
| 1336 | + if (get_sha1(arg, sha1) < 0) |
| 1337 | + usage(describe_usage); |
| 1338 | + cmit = lookup_commit_reference(sha1); |
| 1339 | + if (!cmit) |
| 1340 | + usage(describe_usage); |
| 1341 | + |
| 1342 | if (!initialized) { |
| 1343 | initialized = 1; |
| 1344 | for_each_ref(get_name);</tt></pre> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1345 | </div></div> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 1346 | <ol> |
| 1347 | <li> |
| 1348 | <p> |
| 1349 | It is preceded with a "git diff" header, that looks like |
| 1350 | this (when <em>-c</em> option is used): |
| 1351 | </p> |
| 1352 | <div class="literalblock"> |
| 1353 | <div class="content"> |
| 1354 | <pre><tt>diff --combined file</tt></pre> |
| 1355 | </div></div> |
| 1356 | <p>or like this (when <em>--cc</em> option is used):</p> |
| 1357 | <div class="literalblock"> |
| 1358 | <div class="content"> |
| 1359 | <pre><tt>diff --c file</tt></pre> |
| 1360 | </div></div> |
| 1361 | </li> |
| 1362 | <li> |
| 1363 | <p> |
| 1364 | It is followed by one or more extended header lines |
| 1365 | (this example shows a merge with two parents): |
| 1366 | </p> |
| 1367 | <div class="literalblock"> |
| 1368 | <div class="content"> |
| 1369 | <pre><tt>index <hash>,<hash>..<hash> |
| 1370 | mode <mode>,<mode>..<mode> |
| 1371 | new file mode <mode> |
| 1372 | deleted file mode <mode>,<mode></tt></pre> |
| 1373 | </div></div> |
| 1374 | <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] | 1375 | the <mode> is different from the rest. Extended headers with |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 1376 | information about detected contents movement (renames and |
| 1377 | copying detection) are designed to work with diff of two |
| 1378 | <tree-ish> and are not used by combined diff format.</p> |
| 1379 | </li> |
| 1380 | <li> |
| 1381 | <p> |
| 1382 | It is followed by two-line from-file/to-file header |
| 1383 | </p> |
| 1384 | <div class="literalblock"> |
| 1385 | <div class="content"> |
| 1386 | <pre><tt>--- a/file |
| 1387 | +++ b/file</tt></pre> |
| 1388 | </div></div> |
| 1389 | <p>Similar to two-line header for traditional <em>unified</em> diff |
| 1390 | format, <tt>/dev/null</tt> is used to signal created or deleted |
| 1391 | files.</p> |
| 1392 | </li> |
| 1393 | <li> |
| 1394 | <p> |
| 1395 | Chunk header format is modified to prevent people from |
| 1396 | accidentally feeding it to <tt>patch -p1</tt>. Combined diff format |
| 1397 | was created for review of merge commit changes, and was not |
| 1398 | meant for apply. The change is similar to the change in the |
| 1399 | extended <em>index</em> header: |
| 1400 | </p> |
| 1401 | <div class="literalblock"> |
| 1402 | <div class="content"> |
| 1403 | <pre><tt>@@@ <from-file-range> <from-file-range> <to-file-range> @@@</tt></pre> |
| 1404 | </div></div> |
| 1405 | <p>There are (number of parents + 1) <tt>@</tt> characters in the chunk |
| 1406 | header for combined diff format.</p> |
| 1407 | </li> |
| 1408 | </ol> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1409 | <p>Unlike the traditional <em>unified</em> diff format, which shows two |
| 1410 | files A and B with a single column that has <tt>-</tt> (minus — |
| 1411 | 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] | 1412 | added to B), or <tt>" "</tt> (space — unchanged) prefix, this format |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1413 | compares two or more files file1, file2,… with one file X, and |
| 1414 | shows how X differs from each of fileN. One column for each of |
| 1415 | fileN is prepended to the output line to note how X's line is |
| 1416 | different from it.</p> |
| 1417 | <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] | 1418 | 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] | 1419 | 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] | 1420 | and fileN does not have that line (in other words, the line was |
| 1421 | added, from the point of view of that parent).</p> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1422 | <p>In the above example output, the function signature was changed |
| 1423 | from both files (hence two <tt>-</tt> removals from both file1 and |
| 1424 | file2, plus <tt>++</tt> to mean one line that was added does not appear |
| 1425 | in either file1 nor file2). Also two other lines are the same |
| 1426 | from file1 but do not appear in file2 (hence prefixed with <tt> +</tt>).</p> |
| 1427 | <p>When shown by <tt>git diff-tree -c</tt>, it compares the parents of a |
| 1428 | merge commit with the merge result (i.e. file1..fileN are the |
| 1429 | parents). When shown by <tt>git diff-files -c</tt>, it compares the |
| 1430 | two unresolved merge parents with the working tree file |
| 1431 | (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka |
| 1432 | "their version").</p> |
| 1433 | </div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1434 | <h2>Author</h2> |
| 1435 | <div class="sectionbody"> |
| 1436 | <p>Written by Linus Torvalds <torvalds@osdl.org></p> |
| 1437 | </div> |
| 1438 | <h2>Documentation</h2> |
| 1439 | <div class="sectionbody"> |
| 1440 | <p>Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.</p> |
| 1441 | </div> |
| 1442 | <h2>GIT</h2> |
| 1443 | <div class="sectionbody"> |
| 1444 | <p>Part of the <a href="git.html">git(7)</a> suite</p> |
| 1445 | </div> |
| 1446 | <div id="footer"> |
| 1447 | <div id="footer-text"> |
Junio C Hamano | a3fd83c | 2007-03-02 10:34:36 | [diff] [blame] | 1448 | Last updated 02-Mar-2007 10:34:19 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1449 | </div> |
| 1450 | </div> |
| 1451 | </body> |
| 1452 | </html> |