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 | 6ec31b9 | 2006-02-10 05:52:01 | [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-files(1)</title> |
| 260 | </head> |
| 261 | <body> |
| 262 | <div id="header"> |
| 263 | <h1> |
| 264 | git-diff-files(1) Manual Page |
| 265 | </h1> |
| 266 | <h2>NAME</h2> |
| 267 | <div class="sectionbody"> |
| 268 | <p>git-diff-files - |
| 269 | Compares files in the working tree and the index |
| 270 | </p> |
| 271 | </div> |
| 272 | </div> |
| 273 | <h2>SYNOPSIS</h2> |
| 274 | <div class="sectionbody"> |
Junio C Hamano | 9882a52 | 2007-04-27 08:22:22 | [diff] [blame] | 275 | <p><em>git-diff-files</em> [-q] [-0|-1|-2|-3|-c|--cc|--no-index] [<common diff options>] [<path>…]</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 276 | </div> |
| 277 | <h2>DESCRIPTION</h2> |
| 278 | <div class="sectionbody"> |
| 279 | <p>Compares the files in the working tree and the index. When paths |
| 280 | are specified, compares only those named paths. Otherwise all |
| 281 | entries in the index are compared. The output format is the |
| 282 | same as "git-diff-index" and "git-diff-tree".</p> |
| 283 | </div> |
| 284 | <h2>OPTIONS</h2> |
| 285 | <div class="sectionbody"> |
| 286 | <dl> |
| 287 | <dt> |
| 288 | -p |
| 289 | </dt> |
| 290 | <dd> |
| 291 | <p> |
| 292 | Generate patch (see section on generating patches) |
| 293 | </p> |
| 294 | </dd> |
| 295 | <dt> |
| 296 | -u |
| 297 | </dt> |
| 298 | <dd> |
| 299 | <p> |
| 300 | Synonym for "-p". |
| 301 | </p> |
| 302 | </dd> |
| 303 | <dt> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 304 | --raw |
| 305 | </dt> |
| 306 | <dd> |
| 307 | <p> |
| 308 | Generate the raw format. |
| 309 | </p> |
| 310 | </dd> |
| 311 | <dt> |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 312 | --patch-with-raw |
| 313 | </dt> |
| 314 | <dd> |
| 315 | <p> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 316 | Synonym for "-p --raw". |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 317 | </p> |
| 318 | </dd> |
| 319 | <dt> |
Junio C Hamano | 4a9a76a | 2006-10-01 05:40:29 | [diff] [blame] | 320 | --stat[=width[,name-width]] |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 321 | </dt> |
| 322 | <dd> |
| 323 | <p> |
Junio C Hamano | 4a9a76a | 2006-10-01 05:40:29 | [diff] [blame] | 324 | Generate a diffstat. You can override the default |
| 325 | output width for 80-column terminal by "--stat=width". |
| 326 | The width of the filename part can be controlled by |
| 327 | giving another width to it separated by a comma. |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 328 | </p> |
| 329 | </dd> |
| 330 | <dt> |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 331 | --numstat |
| 332 | </dt> |
| 333 | <dd> |
| 334 | <p> |
| 335 | Similar to --stat, but shows number of added and |
| 336 | deleted lines in decimal notation and pathname without |
Junio C Hamano | d793de5 | 2006-12-26 09:11:43 | [diff] [blame] | 337 | abbreviation, to make it more machine friendly. For |
| 338 | binary files, outputs two <tt>-</tt> instead of saying |
| 339 | <tt>0 0</tt>. |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 340 | </p> |
| 341 | </dd> |
| 342 | <dt> |
Junio C Hamano | 7d23f5e | 2006-12-16 07:44:04 | [diff] [blame] | 343 | --shortstat |
| 344 | </dt> |
| 345 | <dd> |
| 346 | <p> |
| 347 | Output only the last line of the --stat format containing total |
| 348 | number of modified files, as well as number of added and deleted |
| 349 | lines. |
| 350 | </p> |
| 351 | </dd> |
| 352 | <dt> |
Junio C Hamano | 6959c6c | 2006-05-17 10:34:11 | [diff] [blame] | 353 | --summary |
| 354 | </dt> |
| 355 | <dd> |
| 356 | <p> |
| 357 | Output a condensed summary of extended header information |
| 358 | such as creations, renames and mode changes. |
| 359 | </p> |
| 360 | </dd> |
| 361 | <dt> |
Junio C Hamano | d1308c9 | 2006-04-16 11:01:09 | [diff] [blame] | 362 | --patch-with-stat |
| 363 | </dt> |
| 364 | <dd> |
| 365 | <p> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 366 | Synonym for "-p --stat". |
Junio C Hamano | d1308c9 | 2006-04-16 11:01:09 | [diff] [blame] | 367 | </p> |
| 368 | </dd> |
| 369 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 370 | -z |
| 371 | </dt> |
| 372 | <dd> |
| 373 | <p> |
| 374 | \0 line termination on output |
| 375 | </p> |
| 376 | </dd> |
| 377 | <dt> |
| 378 | --name-only |
| 379 | </dt> |
| 380 | <dd> |
| 381 | <p> |
| 382 | Show only names of changed files. |
| 383 | </p> |
| 384 | </dd> |
| 385 | <dt> |
| 386 | --name-status |
| 387 | </dt> |
| 388 | <dd> |
| 389 | <p> |
| 390 | Show only names and status of changed files. |
| 391 | </p> |
| 392 | </dd> |
| 393 | <dt> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 394 | --color |
| 395 | </dt> |
| 396 | <dd> |
| 397 | <p> |
| 398 | Show colored diff. |
| 399 | </p> |
| 400 | </dd> |
| 401 | <dt> |
| 402 | --no-color |
| 403 | </dt> |
| 404 | <dd> |
| 405 | <p> |
| 406 | Turn off colored diff, even when the configuration file |
| 407 | gives the default to color output. |
| 408 | </p> |
| 409 | </dd> |
| 410 | <dt> |
Junio C Hamano | 85e45fa | 2006-08-13 07:47:41 | [diff] [blame] | 411 | --color-words |
| 412 | </dt> |
| 413 | <dd> |
| 414 | <p> |
| 415 | Show colored word diff, i.e. color words which have changed. |
| 416 | </p> |
| 417 | </dd> |
| 418 | <dt> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 419 | --no-renames |
| 420 | </dt> |
| 421 | <dd> |
| 422 | <p> |
| 423 | Turn off rename detection, even when the configuration |
| 424 | file gives the default to do so. |
| 425 | </p> |
| 426 | </dd> |
| 427 | <dt> |
Junio C Hamano | a890c4f | 2007-01-28 10:29:21 | [diff] [blame] | 428 | --check |
| 429 | </dt> |
| 430 | <dd> |
| 431 | <p> |
| 432 | Warn if changes introduce trailing whitespace |
| 433 | or an indent that uses a space before a tab. |
| 434 | </p> |
| 435 | </dd> |
| 436 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 437 | --full-index |
| 438 | </dt> |
| 439 | <dd> |
| 440 | <p> |
| 441 | Instead of the first handful characters, show full |
| 442 | object name of pre- and post-image blob on the "index" |
| 443 | line when generating a patch format output. |
| 444 | </p> |
| 445 | </dd> |
| 446 | <dt> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 447 | --binary |
| 448 | </dt> |
| 449 | <dd> |
| 450 | <p> |
| 451 | In addition to --full-index, output "binary diff" that |
| 452 | can be applied with "git apply". |
| 453 | </p> |
| 454 | </dd> |
| 455 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 456 | --abbrev[=<n>] |
| 457 | </dt> |
| 458 | <dd> |
| 459 | <p> |
| 460 | Instead of showing the full 40-byte hexadecimal object |
| 461 | name in diff-raw format output and diff-tree header |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 462 | lines, show only handful hexdigits prefix. This is |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 463 | independent of --full-index option above, which controls |
| 464 | the diff-patch output format. Non default number of |
| 465 | digits can be specified with --abbrev=<n>. |
| 466 | </p> |
| 467 | </dd> |
| 468 | <dt> |
| 469 | -B |
| 470 | </dt> |
| 471 | <dd> |
| 472 | <p> |
| 473 | Break complete rewrite changes into pairs of delete and create. |
| 474 | </p> |
| 475 | </dd> |
| 476 | <dt> |
| 477 | -M |
| 478 | </dt> |
| 479 | <dd> |
| 480 | <p> |
| 481 | Detect renames. |
| 482 | </p> |
| 483 | </dd> |
| 484 | <dt> |
| 485 | -C |
| 486 | </dt> |
| 487 | <dd> |
| 488 | <p> |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 489 | 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] | 490 | </p> |
| 491 | </dd> |
| 492 | <dt> |
Junio C Hamano | 6ec31b9 | 2006-02-10 05:52:01 | [diff] [blame] | 493 | --diff-filter=[ACDMRTUXB*] |
| 494 | </dt> |
| 495 | <dd> |
| 496 | <p> |
| 497 | Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>), |
| 498 | Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their |
| 499 | type (mode) changed (<tt>T</tt>), are Unmerged (<tt>U</tt>), are |
| 500 | Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>). |
| 501 | Any combination of the filter characters may be used. |
| 502 | When <tt>*</tt> (All-or-none) is added to the combination, all |
| 503 | paths are selected if there is any file that matches |
| 504 | other criteria in the comparison; if there is no file |
| 505 | that matches other criteria, nothing is selected. |
| 506 | </p> |
| 507 | </dd> |
| 508 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 509 | --find-copies-harder |
| 510 | </dt> |
| 511 | <dd> |
| 512 | <p> |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 513 | For performance reasons, by default, <tt>-C</tt> option finds copies only |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 514 | if the original file of the copy was modified in the same |
| 515 | changeset. This flag makes the command |
| 516 | inspect unmodified files as candidates for the source of |
| 517 | copy. This is a very expensive operation for large |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 518 | projects, so use it with caution. Giving more than one |
| 519 | <tt>-C</tt> option has the same effect. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 520 | </p> |
| 521 | </dd> |
| 522 | <dt> |
| 523 | -l<num> |
| 524 | </dt> |
| 525 | <dd> |
| 526 | <p> |
| 527 | -M and -C options require O(n^2) processing time where n |
| 528 | is the number of potential rename/copy targets. This |
| 529 | option prevents rename/copy detection from running if |
| 530 | the number of rename/copy targets exceeds the specified |
| 531 | number. |
| 532 | </p> |
| 533 | </dd> |
| 534 | <dt> |
| 535 | -S<string> |
| 536 | </dt> |
| 537 | <dd> |
| 538 | <p> |
| 539 | Look for differences that contain the change in <string>. |
| 540 | </p> |
| 541 | </dd> |
| 542 | <dt> |
| 543 | --pickaxe-all |
| 544 | </dt> |
| 545 | <dd> |
| 546 | <p> |
| 547 | When -S finds a change, show all the changes in that |
| 548 | changeset, not just the files that contain the change |
| 549 | in <string>. |
| 550 | </p> |
| 551 | </dd> |
| 552 | <dt> |
Junio C Hamano | bfe9e75 | 2006-04-05 21:43:28 | [diff] [blame] | 553 | --pickaxe-regex |
| 554 | </dt> |
| 555 | <dd> |
| 556 | <p> |
| 557 | Make the <string> not a plain string but an extended POSIX |
| 558 | regex to match. |
| 559 | </p> |
| 560 | </dd> |
| 561 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 562 | -O<orderfile> |
| 563 | </dt> |
| 564 | <dd> |
| 565 | <p> |
| 566 | Output the patch in the order specified in the |
| 567 | <orderfile>, which has one shell glob pattern per line. |
| 568 | </p> |
| 569 | </dd> |
| 570 | <dt> |
| 571 | -R |
| 572 | </dt> |
| 573 | <dd> |
| 574 | <p> |
| 575 | Swap two inputs; that is, show differences from index or |
| 576 | on-disk file to tree contents. |
| 577 | </p> |
| 578 | </dd> |
Junio C Hamano | c26f548 | 2006-07-09 09:38:14 | [diff] [blame] | 579 | <dt> |
| 580 | --text |
| 581 | </dt> |
| 582 | <dd> |
| 583 | <p> |
| 584 | Treat all files as text. |
| 585 | </p> |
| 586 | </dd> |
| 587 | <dt> |
| 588 | -a |
| 589 | </dt> |
| 590 | <dd> |
| 591 | <p> |
| 592 | Shorthand for "--text". |
| 593 | </p> |
| 594 | </dd> |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 595 | <dt> |
Junio C Hamano | fd46896 | 2007-02-14 23:45:04 | [diff] [blame] | 596 | --ignore-space-at-eol |
| 597 | </dt> |
| 598 | <dd> |
| 599 | <p> |
| 600 | Ignore changes in white spaces at EOL. |
| 601 | </p> |
| 602 | </dd> |
| 603 | <dt> |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 604 | --ignore-space-change |
| 605 | </dt> |
| 606 | <dd> |
| 607 | <p> |
| 608 | Ignore changes in amount of white space. This ignores white |
| 609 | space at line end, and consider all other sequences of one or |
| 610 | more white space characters to be equivalent. |
| 611 | </p> |
| 612 | </dd> |
| 613 | <dt> |
| 614 | -b |
| 615 | </dt> |
| 616 | <dd> |
| 617 | <p> |
| 618 | Shorthand for "--ignore-space-change". |
| 619 | </p> |
| 620 | </dd> |
| 621 | <dt> |
| 622 | --ignore-all-space |
| 623 | </dt> |
| 624 | <dd> |
| 625 | <p> |
| 626 | Ignore white space when comparing lines. This ignores |
| 627 | difference even if one line has white space where the other |
| 628 | line has none. |
| 629 | </p> |
| 630 | </dd> |
| 631 | <dt> |
| 632 | -w |
| 633 | </dt> |
| 634 | <dd> |
| 635 | <p> |
| 636 | Shorthand for "--ignore-all-space". |
| 637 | </p> |
| 638 | </dd> |
Junio C Hamano | 48fd2f6 | 2007-03-19 02:02:30 | [diff] [blame] | 639 | <dt> |
| 640 | --exit-code |
| 641 | </dt> |
| 642 | <dd> |
| 643 | <p> |
| 644 | Make the program exit with codes similar to diff(1). |
| 645 | That is, it exits with 1 if there were differences and |
| 646 | 0 means no differences. |
| 647 | </p> |
| 648 | </dd> |
Junio C Hamano | 35e5755 | 2007-03-25 07:54:35 | [diff] [blame] | 649 | <dt> |
| 650 | --quiet |
| 651 | </dt> |
| 652 | <dd> |
| 653 | <p> |
| 654 | Disable all output of the program. Implies --exit-code. |
| 655 | </p> |
| 656 | </dd> |
Junio C Hamano | bb0f404 | 2007-07-04 06:41:40 | [diff] [blame^] | 657 | <dt> |
| 658 | --ext-diff |
| 659 | </dt> |
| 660 | <dd> |
| 661 | <p> |
| 662 | Allow an external diff helper to be executed. If you set an |
| 663 | external diff driver with gitlink:gitattributes(5), you need |
| 664 | to use this option with gitlink:git-log(1) and friends. |
| 665 | </p> |
| 666 | </dd> |
| 667 | <dt> |
| 668 | --no-ext-diff |
| 669 | </dt> |
| 670 | <dd> |
| 671 | <p> |
| 672 | Disallow external diff drivers. |
| 673 | </p> |
| 674 | </dd> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 675 | </dl> |
| 676 | <p>For more detailed explanation on these common options, see also |
| 677 | <a href="diffcore.html">diffcore documentation</a>.</p> |
| 678 | <dl> |
| 679 | <dt> |
| 680 | -1 -2 -3 or --base --ours --theirs, and -0 |
| 681 | </dt> |
| 682 | <dd> |
| 683 | <p> |
| 684 | Diff against the "base" version, "our branch" or "their |
| 685 | branch" respectively. With these options, diffs for |
| 686 | merged entries are not shown. |
| 687 | </p> |
| 688 | <p>The default is to diff against our branch (-2) and the |
| 689 | cleanly resolved paths. The option -0 can be given to |
| 690 | omit diff output for unmerged entries and just show "Unmerged".</p> |
| 691 | </dd> |
| 692 | <dt> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 693 | -c,--cc |
| 694 | </dt> |
| 695 | <dd> |
| 696 | <p> |
| 697 | This compares stage 2 (our branch), stage 3 (their |
| 698 | branch) and the working tree file and outputs a combined |
| 699 | diff, similar to the way <em>diff-tree</em> shows a merge |
| 700 | commit with these flags. |
| 701 | </p> |
| 702 | </dd> |
| 703 | <dt> |
Junio C Hamano | 9882a52 | 2007-04-27 08:22:22 | [diff] [blame] | 704 | --no-index |
Junio C Hamano | db911ee | 2007-02-28 08:13:52 | [diff] [blame] | 705 | </dt> |
| 706 | <dd> |
| 707 | <p> |
| 708 | Compare the two given files / directories. |
| 709 | </p> |
| 710 | </dd> |
| 711 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 712 | -q |
| 713 | </dt> |
| 714 | <dd> |
| 715 | <p> |
Junio C Hamano | 51c2ab0 | 2006-07-09 20:38:54 | [diff] [blame] | 716 | Remain silent even on nonexistent files |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 717 | </p> |
| 718 | </dd> |
| 719 | </dl> |
| 720 | </div> |
| 721 | <h2>Output format</h2> |
| 722 | <div class="sectionbody"> |
| 723 | <p>The output format from "git-diff-index", "git-diff-tree" and |
| 724 | "git-diff-files" are very similar.</p> |
| 725 | <p>These commands all compare two sets of things; what is |
| 726 | compared differs:</p> |
| 727 | <dl> |
| 728 | <dt> |
| 729 | git-diff-index <tree-ish> |
| 730 | </dt> |
| 731 | <dd> |
| 732 | <p> |
| 733 | compares the <tree-ish> and the files on the filesystem. |
| 734 | </p> |
| 735 | </dd> |
| 736 | <dt> |
| 737 | git-diff-index --cached <tree-ish> |
| 738 | </dt> |
| 739 | <dd> |
| 740 | <p> |
| 741 | compares the <tree-ish> and the index. |
| 742 | </p> |
| 743 | </dd> |
| 744 | <dt> |
| 745 | git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>…] |
| 746 | </dt> |
| 747 | <dd> |
| 748 | <p> |
| 749 | compares the trees named by the two arguments. |
| 750 | </p> |
| 751 | </dd> |
| 752 | <dt> |
| 753 | git-diff-files [<pattern>…] |
| 754 | </dt> |
| 755 | <dd> |
| 756 | <p> |
| 757 | compares the index and the files on the filesystem. |
| 758 | </p> |
| 759 | </dd> |
| 760 | </dl> |
| 761 | <p>An output line is formatted this way:</p> |
| 762 | <div class="listingblock"> |
| 763 | <div class="content"> |
| 764 | <pre><tt>in-place edit :100644 100644 bcd1234... 0123456... M file0 |
| 765 | copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2 |
| 766 | rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3 |
| 767 | create :000000 100644 0000000... 1234567... A file4 |
| 768 | delete :100644 000000 1234567... 0000000... D file5 |
| 769 | unmerged :000000 000000 0000000... 0000000... U file6</tt></pre> |
| 770 | </div></div> |
| 771 | <p>That is, from the left to the right:</p> |
| 772 | <ol> |
| 773 | <li> |
| 774 | <p> |
| 775 | a colon. |
| 776 | </p> |
| 777 | </li> |
| 778 | <li> |
| 779 | <p> |
| 780 | mode for "src"; 000000 if creation or unmerged. |
| 781 | </p> |
| 782 | </li> |
| 783 | <li> |
| 784 | <p> |
| 785 | a space. |
| 786 | </p> |
| 787 | </li> |
| 788 | <li> |
| 789 | <p> |
| 790 | mode for "dst"; 000000 if deletion or unmerged. |
| 791 | </p> |
| 792 | </li> |
| 793 | <li> |
| 794 | <p> |
| 795 | a space. |
| 796 | </p> |
| 797 | </li> |
| 798 | <li> |
| 799 | <p> |
| 800 | sha1 for "src"; 0{40} if creation or unmerged. |
| 801 | </p> |
| 802 | </li> |
| 803 | <li> |
| 804 | <p> |
| 805 | a space. |
| 806 | </p> |
| 807 | </li> |
| 808 | <li> |
| 809 | <p> |
| 810 | sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree". |
| 811 | </p> |
| 812 | </li> |
| 813 | <li> |
| 814 | <p> |
| 815 | a space. |
| 816 | </p> |
| 817 | </li> |
| 818 | <li> |
| 819 | <p> |
| 820 | status, followed by optional "score" number. |
| 821 | </p> |
| 822 | </li> |
| 823 | <li> |
| 824 | <p> |
| 825 | a tab or a NUL when <em>-z</em> option is used. |
| 826 | </p> |
| 827 | </li> |
| 828 | <li> |
| 829 | <p> |
| 830 | path for "src" |
| 831 | </p> |
| 832 | </li> |
| 833 | <li> |
| 834 | <p> |
| 835 | a tab or a NUL when <em>-z</em> option is used; only exists for C or R. |
| 836 | </p> |
| 837 | </li> |
| 838 | <li> |
| 839 | <p> |
| 840 | path for "dst"; only exists for C or R. |
| 841 | </p> |
| 842 | </li> |
| 843 | <li> |
| 844 | <p> |
| 845 | an LF or a NUL when <em>-z</em> option is used, to terminate the record. |
| 846 | </p> |
| 847 | </li> |
| 848 | </ol> |
| 849 | <p><sha1> is shown as all 0's if a file is new on the filesystem |
| 850 | and it is out of sync with the index.</p> |
| 851 | <p>Example:</p> |
| 852 | <div class="listingblock"> |
| 853 | <div class="content"> |
| 854 | <pre><tt>:100644 100644 5be4a4...... 000000...... M file.c</tt></pre> |
| 855 | </div></div> |
| 856 | <p>When <tt>-z</tt> option is not used, TAB, LF, and backslash characters |
| 857 | in pathnames are represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>, |
| 858 | respectively.</p> |
| 859 | </div> |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 860 | <h2>diff format for merges</h2> |
| 861 | <div class="sectionbody"> |
| 862 | <p>"git-diff-tree" and "git-diff-files" can take <em>-c</em> or <em>--cc</em> option |
| 863 | to generate diff output also for merge commits. The output differs |
| 864 | from the format described above in the following way:</p> |
| 865 | <ol> |
| 866 | <li> |
| 867 | <p> |
| 868 | there is a colon for each parent |
| 869 | </p> |
| 870 | </li> |
| 871 | <li> |
| 872 | <p> |
| 873 | there are more "src" modes and "src" sha1 |
| 874 | </p> |
| 875 | </li> |
| 876 | <li> |
| 877 | <p> |
| 878 | status is concatenated status characters for each parent |
| 879 | </p> |
| 880 | </li> |
| 881 | <li> |
| 882 | <p> |
| 883 | no optional "score" number |
| 884 | </p> |
| 885 | </li> |
| 886 | <li> |
| 887 | <p> |
| 888 | single path, only for "dst" |
| 889 | </p> |
| 890 | </li> |
| 891 | </ol> |
| 892 | <p>Example:</p> |
| 893 | <div class="listingblock"> |
| 894 | <div class="content"> |
| 895 | <pre><tt>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</tt></pre> |
| 896 | </div></div> |
| 897 | <p>Note that <em>combined diff</em> lists only files which were modified from |
| 898 | all parents.</p> |
| 899 | </div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 900 | <h2>Generating patches with -p</h2> |
| 901 | <div class="sectionbody"> |
| 902 | <p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run |
| 903 | 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] | 904 | instead they produce a patch file. You can customize the creation |
| 905 | of such patches via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS |
| 906 | environment variables.</p> |
| 907 | <p>What the -p option produces is slightly different from the traditional |
| 908 | diff format.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 909 | <ol> |
| 910 | <li> |
| 911 | <p> |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 912 | It is preceded with a "git diff" header, that looks like |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 913 | this: |
| 914 | </p> |
| 915 | <div class="literalblock"> |
| 916 | <div class="content"> |
| 917 | <pre><tt>diff --git a/file1 b/file2</tt></pre> |
| 918 | </div></div> |
| 919 | <p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is |
| 920 | involved. Especially, even for a creation or a deletion, |
| 921 | <tt>/dev/null</tt> is _not_ used in place of <tt>a/</tt> or <tt>b/</tt> filenames.</p> |
| 922 | <p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the |
| 923 | name of the source file of the rename/copy and the name of |
| 924 | the file that rename/copy produces, respectively.</p> |
| 925 | </li> |
| 926 | <li> |
| 927 | <p> |
| 928 | It is followed by one or more extended header lines: |
| 929 | </p> |
| 930 | <div class="literalblock"> |
| 931 | <div class="content"> |
| 932 | <pre><tt>old mode <mode> |
| 933 | new mode <mode> |
| 934 | deleted file mode <mode> |
| 935 | new file mode <mode> |
| 936 | copy from <path> |
| 937 | copy to <path> |
| 938 | rename from <path> |
| 939 | rename to <path> |
| 940 | similarity index <number> |
| 941 | dissimilarity index <number> |
| 942 | index <hash>..<hash> <mode></tt></pre> |
| 943 | </div></div> |
| 944 | </li> |
| 945 | <li> |
| 946 | <p> |
Junio C Hamano | a053d54 | 2006-10-27 09:29:13 | [diff] [blame] | 947 | TAB, LF, double quote and backslash characters in pathnames |
| 948 | are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and <tt>\\</tt>, respectively. |
| 949 | If there is need for such substitution then the whole |
| 950 | pathname is put in double quotes. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 951 | </p> |
| 952 | </li> |
| 953 | </ol> |
Junio C Hamano | d526ba9 | 2007-07-02 00:17:42 | [diff] [blame] | 954 | <p>The similarity index is the percentage of unchanged lines, and |
| 955 | the dissimilarity index is the percentage of changed lines. It |
| 956 | is a rounded down integer, followed by a percent sign. The |
| 957 | similarity index value of 100% is thus reserved for two equal |
| 958 | files, while 100% dissimilarity means that no line from the old |
| 959 | file made it into the new one.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 960 | </div> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 961 | <h2>combined diff format</h2> |
| 962 | <div class="sectionbody"> |
| 963 | <p>git-diff-tree and git-diff-files can take <em>-c</em> or <em>--cc</em> option |
| 964 | to produce <em>combined diff</em>, which looks like this:</p> |
| 965 | <div class="listingblock"> |
| 966 | <div class="content"> |
| 967 | <pre><tt>diff --combined describe.c |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 968 | index fabadb8,cc95eb0..4866510 |
| 969 | --- a/describe.c |
| 970 | +++ b/describe.c |
| 971 | @@@ -98,20 -98,12 +98,20 @@@ |
| 972 | return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1; |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 973 | } |
| 974 | |
| 975 | - static void describe(char *arg) |
| 976 | -static void describe(struct commit *cmit, int last_one) |
| 977 | ++static void describe(char *arg, int last_one) |
| 978 | { |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 979 | + unsigned char sha1[20]; |
| 980 | + struct commit *cmit; |
| 981 | struct commit_list *list; |
| 982 | static int initialized = 0; |
| 983 | struct commit_name *n; |
| 984 | |
| 985 | + if (get_sha1(arg, sha1) < 0) |
| 986 | + usage(describe_usage); |
| 987 | + cmit = lookup_commit_reference(sha1); |
| 988 | + if (!cmit) |
| 989 | + usage(describe_usage); |
| 990 | + |
| 991 | if (!initialized) { |
| 992 | initialized = 1; |
| 993 | for_each_ref(get_name);</tt></pre> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 994 | </div></div> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 995 | <ol> |
| 996 | <li> |
| 997 | <p> |
| 998 | It is preceded with a "git diff" header, that looks like |
| 999 | this (when <em>-c</em> option is used): |
| 1000 | </p> |
| 1001 | <div class="literalblock"> |
| 1002 | <div class="content"> |
| 1003 | <pre><tt>diff --combined file</tt></pre> |
| 1004 | </div></div> |
| 1005 | <p>or like this (when <em>--cc</em> option is used):</p> |
| 1006 | <div class="literalblock"> |
| 1007 | <div class="content"> |
| 1008 | <pre><tt>diff --c file</tt></pre> |
| 1009 | </div></div> |
| 1010 | </li> |
| 1011 | <li> |
| 1012 | <p> |
| 1013 | It is followed by one or more extended header lines |
| 1014 | (this example shows a merge with two parents): |
| 1015 | </p> |
| 1016 | <div class="literalblock"> |
| 1017 | <div class="content"> |
| 1018 | <pre><tt>index <hash>,<hash>..<hash> |
| 1019 | mode <mode>,<mode>..<mode> |
| 1020 | new file mode <mode> |
| 1021 | deleted file mode <mode>,<mode></tt></pre> |
| 1022 | </div></div> |
| 1023 | <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] | 1024 | the <mode> is different from the rest. Extended headers with |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 1025 | information about detected contents movement (renames and |
| 1026 | copying detection) are designed to work with diff of two |
| 1027 | <tree-ish> and are not used by combined diff format.</p> |
| 1028 | </li> |
| 1029 | <li> |
| 1030 | <p> |
| 1031 | It is followed by two-line from-file/to-file header |
| 1032 | </p> |
| 1033 | <div class="literalblock"> |
| 1034 | <div class="content"> |
| 1035 | <pre><tt>--- a/file |
| 1036 | +++ b/file</tt></pre> |
| 1037 | </div></div> |
| 1038 | <p>Similar to two-line header for traditional <em>unified</em> diff |
| 1039 | format, <tt>/dev/null</tt> is used to signal created or deleted |
| 1040 | files.</p> |
| 1041 | </li> |
| 1042 | <li> |
| 1043 | <p> |
| 1044 | Chunk header format is modified to prevent people from |
| 1045 | accidentally feeding it to <tt>patch -p1</tt>. Combined diff format |
| 1046 | was created for review of merge commit changes, and was not |
| 1047 | meant for apply. The change is similar to the change in the |
| 1048 | extended <em>index</em> header: |
| 1049 | </p> |
| 1050 | <div class="literalblock"> |
| 1051 | <div class="content"> |
| 1052 | <pre><tt>@@@ <from-file-range> <from-file-range> <to-file-range> @@@</tt></pre> |
| 1053 | </div></div> |
| 1054 | <p>There are (number of parents + 1) <tt>@</tt> characters in the chunk |
| 1055 | header for combined diff format.</p> |
| 1056 | </li> |
| 1057 | </ol> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1058 | <p>Unlike the traditional <em>unified</em> diff format, which shows two |
| 1059 | files A and B with a single column that has <tt>-</tt> (minus — |
| 1060 | 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] | 1061 | added to B), or <tt>" "</tt> (space — unchanged) prefix, this format |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1062 | compares two or more files file1, file2,… with one file X, and |
| 1063 | shows how X differs from each of fileN. One column for each of |
| 1064 | fileN is prepended to the output line to note how X's line is |
| 1065 | different from it.</p> |
| 1066 | <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] | 1067 | 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] | 1068 | 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] | 1069 | and fileN does not have that line (in other words, the line was |
| 1070 | added, from the point of view of that parent).</p> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 1071 | <p>In the above example output, the function signature was changed |
| 1072 | from both files (hence two <tt>-</tt> removals from both file1 and |
| 1073 | file2, plus <tt>++</tt> to mean one line that was added does not appear |
| 1074 | in either file1 nor file2). Also two other lines are the same |
| 1075 | from file1 but do not appear in file2 (hence prefixed with <tt> +</tt>).</p> |
| 1076 | <p>When shown by <tt>git diff-tree -c</tt>, it compares the parents of a |
| 1077 | merge commit with the merge result (i.e. file1..fileN are the |
| 1078 | parents). When shown by <tt>git diff-files -c</tt>, it compares the |
| 1079 | two unresolved merge parents with the working tree file |
| 1080 | (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka |
| 1081 | "their version").</p> |
| 1082 | </div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1083 | <h2>Author</h2> |
| 1084 | <div class="sectionbody"> |
| 1085 | <p>Written by Linus Torvalds <torvalds@osdl.org></p> |
| 1086 | </div> |
| 1087 | <h2>Documentation</h2> |
| 1088 | <div class="sectionbody"> |
| 1089 | <p>Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.</p> |
| 1090 | </div> |
| 1091 | <h2>GIT</h2> |
| 1092 | <div class="sectionbody"> |
| 1093 | <p>Part of the <a href="git.html">git(7)</a> suite</p> |
| 1094 | </div> |
| 1095 | <div id="footer"> |
| 1096 | <div id="footer-text"> |
Junio C Hamano | bb0f404 | 2007-07-04 06:41:40 | [diff] [blame^] | 1097 | Last updated 04-Jul-2007 06:40:52 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1098 | </div> |
| 1099 | </div> |
| 1100 | </body> |
| 1101 | </html> |