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