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 | 0868a30 | 2008-07-22 09:20:44 | [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 | 0868a30 | 2008-07-22 09:20:44 | [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 | 0868a30 | 2008-07-22 09:20:44 | [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 | 0868a30 | 2008-07-22 09:20:44 | [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 | 0868a30 | 2008-07-22 09:20:44 | [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 | 0868a30 | 2008-07-22 09:20:44 | [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 | 0868a30 | 2008-07-22 09:20:44 | [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 | 0868a30 | 2008-07-22 09:20:44 | [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 | 0868a30 | 2008-07-22 09:20:44 | [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 | 0868a30 | 2008-07-22 09:20:44 | [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 | 0868a30 | 2008-07-22 09:20:44 | [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 | 0868a30 | 2008-07-22 09:20:44 | [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 | 0868a30 | 2008-07-22 09:20:44 | [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(1)</title> |
| 308 | </head> |
| 309 | <body> |
| 310 | <div id="header"> |
| 311 | <h1> |
| 312 | git-diff(1) Manual Page |
| 313 | </h1> |
| 314 | <h2>NAME</h2> |
| 315 | <div class="sectionbody"> |
| 316 | <p>git-diff - |
Junio C Hamano | 0107892 | 2006-03-10 00:31:47 | [diff] [blame] | 317 | Show changes between commits, commit and working tree, etc |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 318 | </p> |
| 319 | </div> |
| 320 | </div> |
| 321 | <h2>SYNOPSIS</h2> |
| 322 | <div class="sectionbody"> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 323 | <div class="para"><p><em>git diff</em> [<common diff options>] <commit>{0,2} [--] [<path>…]</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 324 | </div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 325 | <h2 id="_description">DESCRIPTION</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 326 | <div class="sectionbody"> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 327 | <div class="para"><p>Show changes between two trees, a tree and the working tree, a |
| 328 | tree and the index file, or the index file and the working tree.</p></div> |
| 329 | <div class="vlist"><dl> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 330 | <dt> |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 331 | <em>git diff</em> [--options] [--] [<path>…] |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 332 | </dt> |
| 333 | <dd> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 334 | <p> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 335 | This form is to view the changes you made relative to |
| 336 | the index (staging area for the next commit). In other |
Junio C Hamano | e1b2683 | 2009-11-15 10:02:56 | [diff] [blame] | 337 | words, the differences are what you _could_ tell git to |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 338 | further add to the index but you still haven't. You can |
| 339 | stage these changes by using <a href="git-add.html">git-add(1)</a>. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 340 | </p> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 341 | <div class="para"><p>If exactly two paths are given, and at least one is untracked, |
Junio C Hamano | db911ee | 2007-02-28 08:13:52 | [diff] [blame] | 342 | compare the two files / directories. This behavior can be |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 343 | forced by --no-index.</p></div> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 344 | </dd> |
| 345 | <dt> |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 346 | <em>git diff</em> [--options] --cached [<commit>] [--] [<path>…] |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 347 | </dt> |
| 348 | <dd> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 349 | <p> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 350 | This form is to view the changes you staged for the next |
Junio C Hamano | 4bf6dca | 2006-12-21 02:25:57 | [diff] [blame] | 351 | commit relative to the named <commit>. Typically you |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 352 | would want comparison with the latest commit, so if you |
| 353 | do not give <commit>, it defaults to HEAD. |
Junio C Hamano | 8b4977b | 2008-11-12 04:57:48 | [diff] [blame] | 354 | --staged is a synonym of --cached. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 355 | </p> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 356 | </dd> |
| 357 | <dt> |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 358 | <em>git diff</em> [--options] <commit> [--] [<path>…] |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 359 | </dt> |
| 360 | <dd> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 361 | <p> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 362 | This form is to view the changes you have in your |
| 363 | working tree relative to the named <commit>. You can |
| 364 | use HEAD to compare it with the latest commit, or a |
| 365 | branch name to compare with the tip of a different |
| 366 | branch. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 367 | </p> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 368 | </dd> |
| 369 | <dt> |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 370 | <em>git diff</em> [--options] <commit> <commit> [--] [<path>…] |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 371 | </dt> |
| 372 | <dd> |
| 373 | <p> |
Junio C Hamano | c435b1c | 2007-08-28 06:25:35 | [diff] [blame] | 374 | This is to view the changes between two arbitrary |
| 375 | <commit>. |
| 376 | </p> |
| 377 | </dd> |
| 378 | <dt> |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 379 | <em>git diff</em> [--options] <commit>..<commit> [--] [<path>…] |
Junio C Hamano | c435b1c | 2007-08-28 06:25:35 | [diff] [blame] | 380 | </dt> |
| 381 | <dd> |
| 382 | <p> |
| 383 | This is synonymous to the previous form. If <commit> on |
| 384 | one side is omitted, it will have the same effect as |
| 385 | using HEAD instead. |
| 386 | </p> |
| 387 | </dd> |
| 388 | <dt> |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 389 | <em>git diff</em> [--options] <commit>...<commit> [--] [<path>…] |
Junio C Hamano | c435b1c | 2007-08-28 06:25:35 | [diff] [blame] | 390 | </dt> |
| 391 | <dd> |
| 392 | <p> |
| 393 | This form is to view the changes on the branch containing |
| 394 | and up to the second <commit>, starting at a common ancestor |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 395 | of both <commit>. "git diff A...B" is equivalent to |
| 396 | "git diff $(git-merge-base A B) B". You can omit any one |
Junio C Hamano | c435b1c | 2007-08-28 06:25:35 | [diff] [blame] | 397 | of <commit>, which has the same effect as using HEAD instead. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 398 | </p> |
| 399 | </dd> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 400 | </dl></div> |
| 401 | <div class="para"><p>Just in case if you are doing something exotic, it should be |
Junio C Hamano | 7d9e9bd | 2007-08-29 07:31:47 | [diff] [blame] | 402 | noted that all of the <commit> in the above description, except |
| 403 | for the last two forms that use ".." notations, can be any |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 404 | <tree-ish>.</p></div> |
| 405 | <div class="para"><p>For a more complete list of ways to spell <commit>, see |
Junio C Hamano | c435b1c | 2007-08-28 06:25:35 | [diff] [blame] | 406 | "SPECIFYING REVISIONS" section in <a href="git-rev-parse.html">git-rev-parse(1)</a>. |
Junio C Hamano | e1b2683 | 2009-11-15 10:02:56 | [diff] [blame] | 407 | However, "diff" is about comparing two _endpoints_, not ranges, |
Junio C Hamano | c435b1c | 2007-08-28 06:25:35 | [diff] [blame] | 408 | and the range notations ("<commit>..<commit>" and |
Junio C Hamano | 7d9e9bd | 2007-08-29 07:31:47 | [diff] [blame] | 409 | "<commit>...<commit>") do not mean a range as defined in the |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 410 | "SPECIFYING RANGES" section in <a href="git-rev-parse.html">git-rev-parse(1)</a>.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 411 | </div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 412 | <h2 id="_options">OPTIONS</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 413 | <div class="sectionbody"> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 414 | <div class="vlist"><dl> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 415 | <dt> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 416 | -p |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 417 | </dt> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 418 | <dt> |
| 419 | -u |
| 420 | </dt> |
Junio C Hamano | e97d577 | 2010-05-19 08:13:58 | [diff] [blame] | 421 | <dt> |
| 422 | --patch |
| 423 | </dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 424 | <dd> |
| 425 | <p> |
Junio C Hamano | ff97979 | 2007-11-16 10:11:30 | [diff] [blame] | 426 | Generate patch (see section on generating patches). |
| 427 | This is the default. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 428 | </p> |
| 429 | </dd> |
| 430 | <dt> |
Junio C Hamano | 6936156 | 2007-07-26 02:14:34 | [diff] [blame] | 431 | -U<n> |
| 432 | </dt> |
Junio C Hamano | 6936156 | 2007-07-26 02:14:34 | [diff] [blame] | 433 | <dt> |
| 434 | --unified=<n> |
| 435 | </dt> |
| 436 | <dd> |
| 437 | <p> |
| 438 | Generate diffs with <n> lines of context instead of |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 439 | the usual three. |
| 440 | Implies <tt>-p</tt>. |
Junio C Hamano | 6936156 | 2007-07-26 02:14:34 | [diff] [blame] | 441 | </p> |
| 442 | </dd> |
| 443 | <dt> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 444 | --raw |
| 445 | </dt> |
| 446 | <dd> |
| 447 | <p> |
| 448 | Generate the raw format. |
Junio C Hamano | ff97979 | 2007-11-16 10:11:30 | [diff] [blame] | 449 | |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 450 | </p> |
| 451 | </dd> |
| 452 | <dt> |
| 453 | --patch-with-raw |
| 454 | </dt> |
| 455 | <dd> |
| 456 | <p> |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 457 | Synonym for <tt>-p --raw</tt>. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 458 | </p> |
| 459 | </dd> |
Junio C Hamano | 20d47e3 | 2009-01-26 06:36:02 | [diff] [blame] | 460 | <dt> |
| 461 | --patience |
| 462 | </dt> |
| 463 | <dd> |
| 464 | <p> |
| 465 | Generate a diff using the "patience diff" algorithm. |
| 466 | </p> |
| 467 | </dd> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 468 | <dt> |
| 469 | --stat[=width[,name-width]] |
| 470 | </dt> |
| 471 | <dd> |
| 472 | <p> |
| 473 | Generate a diffstat. You can override the default |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 474 | output width for 80-column terminal by <tt>--stat=width</tt>. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 475 | The width of the filename part can be controlled by |
| 476 | giving another width to it separated by a comma. |
| 477 | </p> |
| 478 | </dd> |
| 479 | <dt> |
| 480 | --numstat |
| 481 | </dt> |
| 482 | <dd> |
| 483 | <p> |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 484 | Similar to <tt>--stat</tt>, but shows number of added and |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 485 | deleted lines in decimal notation and pathname without |
Junio C Hamano | d793de5 | 2006-12-26 09:11:43 | [diff] [blame] | 486 | abbreviation, to make it more machine friendly. For |
| 487 | binary files, outputs two <tt>-</tt> instead of saying |
| 488 | <tt>0 0</tt>. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 489 | </p> |
| 490 | </dd> |
| 491 | <dt> |
Junio C Hamano | 7d23f5e | 2006-12-16 07:44:04 | [diff] [blame] | 492 | --shortstat |
| 493 | </dt> |
| 494 | <dd> |
| 495 | <p> |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 496 | Output only the last line of the <tt>--stat</tt> format containing total |
Junio C Hamano | 7d23f5e | 2006-12-16 07:44:04 | [diff] [blame] | 497 | number of modified files, as well as number of added and deleted |
| 498 | lines. |
| 499 | </p> |
| 500 | </dd> |
| 501 | <dt> |
Junio C Hamano | 6a45be9 | 2008-04-22 08:19:03 | [diff] [blame] | 502 | --dirstat[=limit] |
| 503 | </dt> |
| 504 | <dd> |
| 505 | <p> |
Junio C Hamano | a2f4662 | 2008-09-03 05:20:31 | [diff] [blame] | 506 | Output the distribution of relative amount of changes (number of lines added or |
| 507 | removed) for each sub-directory. Directories with changes below |
| 508 | a cut-off percent (3% by default) are not shown. The cut-off percent |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 509 | can be set with <tt>--dirstat=limit</tt>. Changes in a child directory is not |
| 510 | counted for the parent directory, unless <tt>--cumulative</tt> is used. |
Junio C Hamano | 6a45be9 | 2008-04-22 08:19:03 | [diff] [blame] | 511 | </p> |
| 512 | </dd> |
| 513 | <dt> |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 514 | --dirstat-by-file[=limit] |
| 515 | </dt> |
| 516 | <dd> |
| 517 | <p> |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 518 | Same as <tt>--dirstat</tt>, but counts changed files instead of lines. |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 519 | </p> |
| 520 | </dd> |
| 521 | <dt> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 522 | --summary |
| 523 | </dt> |
| 524 | <dd> |
| 525 | <p> |
| 526 | Output a condensed summary of extended header information |
| 527 | such as creations, renames and mode changes. |
| 528 | </p> |
| 529 | </dd> |
| 530 | <dt> |
| 531 | --patch-with-stat |
| 532 | </dt> |
| 533 | <dd> |
| 534 | <p> |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 535 | Synonym for <tt>-p --stat</tt>. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 536 | </p> |
| 537 | </dd> |
| 538 | <dt> |
| 539 | -z |
| 540 | </dt> |
| 541 | <dd> |
| 542 | <p> |
Junio C Hamano | 0c053e8 | 2010-04-19 06:46:34 | [diff] [blame] | 543 | When <tt>--raw</tt>, <tt>--numstat</tt>, <tt>--name-only</tt> or <tt>--name-status</tt> has been |
| 544 | given, do not munge pathnames and use NULs as output field terminators. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 545 | </p> |
Junio C Hamano | 5706e0b | 2009-11-24 10:54:16 | [diff] [blame] | 546 | <div class="para"><p>Without this option, each pathname output will have TAB, LF, double quotes, |
| 547 | and backslash characters replaced with <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt>, and <tt>\\</tt>, |
| 548 | respectively, and the pathname will be enclosed in double quotes if |
| 549 | any of those replacements occurred.</p></div> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 550 | </dd> |
| 551 | <dt> |
| 552 | --name-only |
| 553 | </dt> |
| 554 | <dd> |
| 555 | <p> |
| 556 | Show only names of changed files. |
| 557 | </p> |
| 558 | </dd> |
| 559 | <dt> |
| 560 | --name-status |
| 561 | </dt> |
| 562 | <dd> |
| 563 | <p> |
Junio C Hamano | a9aee78 | 2008-04-23 16:09:20 | [diff] [blame] | 564 | Show only names and status of changed files. See the description |
| 565 | of the <tt>--diff-filter</tt> option on what the status letters mean. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 566 | </p> |
| 567 | </dd> |
| 568 | <dt> |
Junio C Hamano | c21ab05 | 2009-10-31 04:03:55 | [diff] [blame] | 569 | --submodule[=<format>] |
| 570 | </dt> |
| 571 | <dd> |
| 572 | <p> |
| 573 | Chose the output format for submodule differences. <format> can be one of |
| 574 | <em>short</em> and <em>log</em>. <em>short</em> just shows pairs of commit names, this format |
| 575 | is used when this option is not given. <em>log</em> is the default value for this |
| 576 | option and lists the commits in that commit range like the <em>summary</em> |
| 577 | option of <a href="git-submodule.html">git-submodule(1)</a> does. |
| 578 | </p> |
| 579 | </dd> |
| 580 | <dt> |
Junio C Hamano | 4aa0bcc | 2010-03-03 05:13:12 | [diff] [blame] | 581 | --color[=<when>] |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 582 | </dt> |
| 583 | <dd> |
| 584 | <p> |
| 585 | Show colored diff. |
Junio C Hamano | 4aa0bcc | 2010-03-03 05:13:12 | [diff] [blame] | 586 | The value must be always (the default), never, or auto. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 587 | </p> |
| 588 | </dd> |
| 589 | <dt> |
| 590 | --no-color |
| 591 | </dt> |
| 592 | <dd> |
| 593 | <p> |
| 594 | Turn off colored diff, even when the configuration file |
| 595 | gives the default to color output. |
Junio C Hamano | 4aa0bcc | 2010-03-03 05:13:12 | [diff] [blame] | 596 | Same as <tt>--color=never</tt>. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 597 | </p> |
| 598 | </dd> |
| 599 | <dt> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame^] | 600 | --word-diff[=<mode>] |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 601 | </dt> |
| 602 | <dd> |
| 603 | <p> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame^] | 604 | Show a word diff, using the <mode> to delimit changed words. |
| 605 | By default, words are delimited by whitespace; see |
| 606 | <tt>--word-diff-regex</tt> below. The <mode> defaults to <em>plain</em>, and |
| 607 | must be one of: |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 608 | </p> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame^] | 609 | <div class="vlist"><dl> |
| 610 | <dt> |
| 611 | color |
| 612 | </dt> |
| 613 | <dd> |
| 614 | <p> |
| 615 | Highlight changed words using only colors. Implies <tt>--color</tt>. |
| 616 | </p> |
| 617 | </dd> |
| 618 | <dt> |
| 619 | plain |
| 620 | </dt> |
| 621 | <dd> |
| 622 | <p> |
| 623 | Show words as <tt>[-removed-]</tt> and <tt>{+added+}</tt>. Makes no |
| 624 | attempts to escape the delimiters if they appear in the input, |
| 625 | so the output may be ambiguous. |
| 626 | </p> |
| 627 | </dd> |
| 628 | <dt> |
| 629 | porcelain |
| 630 | </dt> |
| 631 | <dd> |
| 632 | <p> |
| 633 | Use a special line-based format intended for script |
| 634 | consumption. Added/removed/unchanged runs are printed in the |
| 635 | usual unified diff format, starting with a <tt>+</tt>/<tt>-</tt>/<tt> </tt> |
| 636 | character at the beginning of the line and extending to the |
| 637 | end of the line. Newlines in the input are represented by a |
| 638 | tilde <tt>~</tt> on a line of its own. |
| 639 | </p> |
| 640 | </dd> |
| 641 | <dt> |
| 642 | none |
| 643 | </dt> |
| 644 | <dd> |
| 645 | <p> |
| 646 | Disable word diff again. |
| 647 | </p> |
| 648 | </dd> |
| 649 | </dl></div> |
| 650 | <div class="para"><p>Note that despite the name of the first mode, color is used to |
| 651 | highlight the changed parts in all modes if enabled.</p></div> |
| 652 | </dd> |
| 653 | <dt> |
| 654 | --word-diff-regex=<regex> |
| 655 | </dt> |
| 656 | <dd> |
| 657 | <p> |
| 658 | Use <regex> to decide what a word is, instead of considering |
| 659 | runs of non-whitespace to be a word. Also implies |
| 660 | <tt>--word-diff</tt> unless it was already enabled. |
| 661 | </p> |
| 662 | <div class="para"><p>Every non-overlapping match of the |
Junio C Hamano | 20d47e3 | 2009-01-26 06:36:02 | [diff] [blame] | 663 | <regex> is considered a word. Anything between these matches is |
| 664 | considered whitespace and ignored(!) for the purposes of finding |
| 665 | differences. You may want to append <tt>|[^[:space:]]</tt> to your regular |
| 666 | expression to make sure that it matches all non-whitespace characters. |
| 667 | A match that contains a newline is silently truncated(!) at the |
| 668 | newline.</p></div> |
| 669 | <div class="para"><p>The regex can also be set via a diff driver or configuration option, see |
| 670 | <a href="gitattributes.html">gitattributes(1)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly |
| 671 | overrides any diff driver or configuration setting. Diff drivers |
| 672 | override configuration settings.</p></div> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 673 | </dd> |
| 674 | <dt> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame^] | 675 | --color-words[=<regex>] |
| 676 | </dt> |
| 677 | <dd> |
| 678 | <p> |
| 679 | Equivalent to <tt>--word-diff=color</tt> plus (if a regex was |
| 680 | specified) <tt>--word-diff-regex=<regex></tt>. |
| 681 | </p> |
| 682 | </dd> |
| 683 | <dt> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 684 | --no-renames |
| 685 | </dt> |
| 686 | <dd> |
| 687 | <p> |
| 688 | Turn off rename detection, even when the configuration |
| 689 | file gives the default to do so. |
| 690 | </p> |
| 691 | </dd> |
| 692 | <dt> |
Junio C Hamano | a890c4f | 2007-01-28 10:29:21 | [diff] [blame] | 693 | --check |
| 694 | </dt> |
| 695 | <dd> |
| 696 | <p> |
| 697 | Warn if changes introduce trailing whitespace |
Junio C Hamano | 3dac504 | 2007-12-15 08:40:54 | [diff] [blame] | 698 | or an indent that uses a space before a tab. Exits with |
| 699 | non-zero status if problems are found. Not compatible with |
| 700 | --exit-code. |
Junio C Hamano | a890c4f | 2007-01-28 10:29:21 | [diff] [blame] | 701 | </p> |
| 702 | </dd> |
| 703 | <dt> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 704 | --full-index |
| 705 | </dt> |
| 706 | <dd> |
| 707 | <p> |
Junio C Hamano | 5cf43ca | 2008-08-20 09:14:14 | [diff] [blame] | 708 | Instead of the first handful of characters, show the full |
| 709 | pre- and post-image blob object names on the "index" |
| 710 | line when generating patch format output. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 711 | </p> |
| 712 | </dd> |
| 713 | <dt> |
| 714 | --binary |
| 715 | </dt> |
| 716 | <dd> |
| 717 | <p> |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 718 | In addition to <tt>--full-index</tt>, output a binary diff that |
| 719 | can be applied with <tt>git-apply</tt>. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 720 | </p> |
| 721 | </dd> |
| 722 | <dt> |
| 723 | --abbrev[=<n>] |
| 724 | </dt> |
| 725 | <dd> |
| 726 | <p> |
| 727 | Instead of showing the full 40-byte hexadecimal object |
| 728 | name in diff-raw format output and diff-tree header |
Junio C Hamano | 6efe302 | 2009-01-13 16:47:56 | [diff] [blame] | 729 | lines, show only a partial prefix. This is |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 730 | independent of the <tt>--full-index</tt> option above, which controls |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 731 | the diff-patch output format. Non default number of |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 732 | digits can be specified with <tt>--abbrev=<n></tt>. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 733 | </p> |
| 734 | </dd> |
| 735 | <dt> |
| 736 | -B |
| 737 | </dt> |
| 738 | <dd> |
| 739 | <p> |
| 740 | Break complete rewrite changes into pairs of delete and create. |
| 741 | </p> |
| 742 | </dd> |
| 743 | <dt> |
| 744 | -M |
| 745 | </dt> |
| 746 | <dd> |
| 747 | <p> |
| 748 | Detect renames. |
| 749 | </p> |
| 750 | </dd> |
| 751 | <dt> |
| 752 | -C |
| 753 | </dt> |
| 754 | <dd> |
| 755 | <p> |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 756 | Detect copies as well as renames. See also <tt>--find-copies-harder</tt>. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 757 | </p> |
| 758 | </dd> |
| 759 | <dt> |
| 760 | --diff-filter=[ACDMRTUXB*] |
| 761 | </dt> |
| 762 | <dd> |
| 763 | <p> |
| 764 | Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>), |
| 765 | 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] | 766 | type (i.e. regular file, symlink, submodule, …) changed (<tt>T</tt>), |
| 767 | are Unmerged (<tt>U</tt>), are |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 768 | Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>). |
| 769 | Any combination of the filter characters may be used. |
| 770 | When <tt>*</tt> (All-or-none) is added to the combination, all |
| 771 | paths are selected if there is any file that matches |
| 772 | other criteria in the comparison; if there is no file |
| 773 | that matches other criteria, nothing is selected. |
| 774 | </p> |
| 775 | </dd> |
| 776 | <dt> |
| 777 | --find-copies-harder |
| 778 | </dt> |
| 779 | <dd> |
| 780 | <p> |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 781 | For performance reasons, by default, <tt>-C</tt> option finds copies only |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 782 | if the original file of the copy was modified in the same |
| 783 | changeset. This flag makes the command |
| 784 | inspect unmodified files as candidates for the source of |
| 785 | copy. This is a very expensive operation for large |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 786 | projects, so use it with caution. Giving more than one |
| 787 | <tt>-C</tt> option has the same effect. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 788 | </p> |
| 789 | </dd> |
| 790 | <dt> |
| 791 | -l<num> |
| 792 | </dt> |
| 793 | <dd> |
| 794 | <p> |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 795 | The <tt>-M</tt> and <tt>-C</tt> options require O(n^2) processing time where n |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 796 | is the number of potential rename/copy targets. This |
| 797 | option prevents rename/copy detection from running if |
| 798 | the number of rename/copy targets exceeds the specified |
| 799 | number. |
| 800 | </p> |
| 801 | </dd> |
| 802 | <dt> |
| 803 | -S<string> |
| 804 | </dt> |
| 805 | <dd> |
| 806 | <p> |
Junio C Hamano | 5217a27 | 2009-03-21 00:39:33 | [diff] [blame] | 807 | Look for differences that introduce or remove an instance of |
| 808 | <string>. Note that this is different than the string simply |
| 809 | appearing in diff output; see the <em>pickaxe</em> entry in |
| 810 | <a href="gitdiffcore.html">gitdiffcore(7)</a> for more details. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 811 | </p> |
| 812 | </dd> |
| 813 | <dt> |
| 814 | --pickaxe-all |
| 815 | </dt> |
| 816 | <dd> |
| 817 | <p> |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 818 | When <tt>-S</tt> finds a change, show all the changes in that |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 819 | changeset, not just the files that contain the change |
| 820 | in <string>. |
| 821 | </p> |
| 822 | </dd> |
| 823 | <dt> |
| 824 | --pickaxe-regex |
| 825 | </dt> |
| 826 | <dd> |
| 827 | <p> |
| 828 | Make the <string> not a plain string but an extended POSIX |
| 829 | regex to match. |
| 830 | </p> |
| 831 | </dd> |
| 832 | <dt> |
| 833 | -O<orderfile> |
| 834 | </dt> |
| 835 | <dd> |
| 836 | <p> |
| 837 | Output the patch in the order specified in the |
| 838 | <orderfile>, which has one shell glob pattern per line. |
| 839 | </p> |
| 840 | </dd> |
| 841 | <dt> |
| 842 | -R |
| 843 | </dt> |
| 844 | <dd> |
| 845 | <p> |
| 846 | Swap two inputs; that is, show differences from index or |
| 847 | on-disk file to tree contents. |
| 848 | </p> |
| 849 | </dd> |
| 850 | <dt> |
Junio C Hamano | 24bc09a | 2008-02-28 00:27:44 | [diff] [blame] | 851 | --relative[=<path>] |
| 852 | </dt> |
| 853 | <dd> |
| 854 | <p> |
| 855 | When run from a subdirectory of the project, it can be |
| 856 | told to exclude changes outside the directory and show |
| 857 | pathnames relative to it with this option. When you are |
| 858 | not in a subdirectory (e.g. in a bare repository), you |
| 859 | can name which subdirectory to make the output relative |
| 860 | to by giving a <path> as an argument. |
| 861 | </p> |
| 862 | </dd> |
| 863 | <dt> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 864 | -a |
| 865 | </dt> |
| 866 | <dt> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 867 | --text |
| 868 | </dt> |
| 869 | <dd> |
| 870 | <p> |
| 871 | Treat all files as text. |
| 872 | </p> |
| 873 | </dd> |
| 874 | <dt> |
Junio C Hamano | fd46896 | 2007-02-14 23:45:04 | [diff] [blame] | 875 | --ignore-space-at-eol |
| 876 | </dt> |
| 877 | <dd> |
| 878 | <p> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 879 | Ignore changes in whitespace at EOL. |
Junio C Hamano | fd46896 | 2007-02-14 23:45:04 | [diff] [blame] | 880 | </p> |
| 881 | </dd> |
| 882 | <dt> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 883 | -b |
| 884 | </dt> |
| 885 | <dt> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 886 | --ignore-space-change |
| 887 | </dt> |
| 888 | <dd> |
| 889 | <p> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 890 | Ignore changes in amount of whitespace. This ignores whitespace |
| 891 | at line end, and considers all other sequences of one or |
| 892 | more whitespace characters to be equivalent. |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 893 | </p> |
| 894 | </dd> |
| 895 | <dt> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 896 | -w |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 897 | </dt> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 898 | <dt> |
| 899 | --ignore-all-space |
| 900 | </dt> |
| 901 | <dd> |
| 902 | <p> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 903 | Ignore whitespace when comparing lines. This ignores |
| 904 | differences even if one line has whitespace where the other |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 905 | line has none. |
| 906 | </p> |
| 907 | </dd> |
| 908 | <dt> |
Junio C Hamano | 1d40ee8 | 2009-01-07 10:14:16 | [diff] [blame] | 909 | --inter-hunk-context=<lines> |
| 910 | </dt> |
| 911 | <dd> |
| 912 | <p> |
| 913 | Show the context between diff hunks, up to the specified number |
| 914 | of lines, thereby fusing hunks that are close to each other. |
| 915 | </p> |
| 916 | </dd> |
| 917 | <dt> |
Junio C Hamano | 48fd2f6 | 2007-03-19 02:02:30 | [diff] [blame] | 918 | --exit-code |
| 919 | </dt> |
| 920 | <dd> |
| 921 | <p> |
| 922 | Make the program exit with codes similar to diff(1). |
| 923 | That is, it exits with 1 if there were differences and |
| 924 | 0 means no differences. |
| 925 | </p> |
| 926 | </dd> |
Junio C Hamano | 35e5755 | 2007-03-25 07:54:35 | [diff] [blame] | 927 | <dt> |
| 928 | --quiet |
| 929 | </dt> |
| 930 | <dd> |
| 931 | <p> |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 932 | Disable all output of the program. Implies <tt>--exit-code</tt>. |
Junio C Hamano | 35e5755 | 2007-03-25 07:54:35 | [diff] [blame] | 933 | </p> |
| 934 | </dd> |
Junio C Hamano | bb0f404 | 2007-07-04 06:41:40 | [diff] [blame] | 935 | <dt> |
| 936 | --ext-diff |
| 937 | </dt> |
| 938 | <dd> |
| 939 | <p> |
| 940 | Allow an external diff helper to be executed. If you set an |
Junio C Hamano | 1b50ce9 | 2007-10-03 12:05:53 | [diff] [blame] | 941 | external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need |
| 942 | 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] | 943 | </p> |
| 944 | </dd> |
| 945 | <dt> |
| 946 | --no-ext-diff |
| 947 | </dt> |
| 948 | <dd> |
| 949 | <p> |
| 950 | Disallow external diff drivers. |
| 951 | </p> |
| 952 | </dd> |
Junio C Hamano | e27cbd2 | 2007-12-21 17:57:33 | [diff] [blame] | 953 | <dt> |
Junio C Hamano | dfccbb0 | 2008-05-26 01:16:14 | [diff] [blame] | 954 | --ignore-submodules |
| 955 | </dt> |
| 956 | <dd> |
| 957 | <p> |
| 958 | Ignore changes to submodules in the diff generation. |
| 959 | </p> |
| 960 | </dd> |
| 961 | <dt> |
Junio C Hamano | e27cbd2 | 2007-12-21 17:57:33 | [diff] [blame] | 962 | --src-prefix=<prefix> |
| 963 | </dt> |
| 964 | <dd> |
| 965 | <p> |
| 966 | Show the given source prefix instead of "a/". |
| 967 | </p> |
| 968 | </dd> |
| 969 | <dt> |
| 970 | --dst-prefix=<prefix> |
| 971 | </dt> |
| 972 | <dd> |
| 973 | <p> |
| 974 | Show the given destination prefix instead of "b/". |
| 975 | </p> |
| 976 | </dd> |
| 977 | <dt> |
| 978 | --no-prefix |
| 979 | </dt> |
| 980 | <dd> |
| 981 | <p> |
| 982 | Do not show any source or destination prefix. |
| 983 | </p> |
| 984 | </dd> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 985 | </dl></div> |
| 986 | <div class="para"><p>For more detailed explanation on these common options, see also |
| 987 | <a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div> |
| 988 | <div class="vlist"><dl> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 989 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 990 | <path>… |
| 991 | </dt> |
| 992 | <dd> |
| 993 | <p> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 994 | The <paths> parameters, when given, are used to limit |
| 995 | the diff to the named paths (you can give directory |
| 996 | names and get diff for all files under them). |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 997 | </p> |
| 998 | </dd> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 999 | </dl></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1000 | </div> |
Junio C Hamano | 543f8d6 | 2009-07-29 08:35:21 | [diff] [blame] | 1001 | <h2 id="_raw_output_format">Raw output format</h2> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1002 | <div class="sectionbody"> |
Junio C Hamano | 543f8d6 | 2009-07-29 08:35:21 | [diff] [blame] | 1003 | <div class="para"><p>The raw output format from "git-diff-index", "git-diff-tree", |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1004 | "git-diff-files" and "git diff --raw" are very similar.</p></div> |
| 1005 | <div class="para"><p>These commands all compare two sets of things; what is |
| 1006 | compared differs:</p></div> |
| 1007 | <div class="vlist"><dl> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1008 | <dt> |
| 1009 | git-diff-index <tree-ish> |
| 1010 | </dt> |
| 1011 | <dd> |
| 1012 | <p> |
| 1013 | compares the <tree-ish> and the files on the filesystem. |
| 1014 | </p> |
| 1015 | </dd> |
| 1016 | <dt> |
| 1017 | git-diff-index --cached <tree-ish> |
| 1018 | </dt> |
| 1019 | <dd> |
| 1020 | <p> |
| 1021 | compares the <tree-ish> and the index. |
| 1022 | </p> |
| 1023 | </dd> |
| 1024 | <dt> |
| 1025 | git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>…] |
| 1026 | </dt> |
| 1027 | <dd> |
| 1028 | <p> |
| 1029 | compares the trees named by the two arguments. |
| 1030 | </p> |
| 1031 | </dd> |
| 1032 | <dt> |
| 1033 | git-diff-files [<pattern>…] |
| 1034 | </dt> |
| 1035 | <dd> |
| 1036 | <p> |
| 1037 | compares the index and the files on the filesystem. |
| 1038 | </p> |
| 1039 | </dd> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1040 | </dl></div> |
Junio C Hamano | 167b138 | 2010-01-31 23:04:31 | [diff] [blame] | 1041 | <div class="para"><p>The "git-diff-tree" command begins its output by printing the hash of |
Junio C Hamano | 543f8d6 | 2009-07-29 08:35:21 | [diff] [blame] | 1042 | what is being compared. After that, all the commands print one output |
| 1043 | line per changed file.</p></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1044 | <div class="para"><p>An output line is formatted this way:</p></div> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1045 | <div class="listingblock"> |
| 1046 | <div class="content"> |
| 1047 | <pre><tt>in-place edit :100644 100644 bcd1234... 0123456... M file0 |
| 1048 | copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2 |
| 1049 | rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3 |
| 1050 | create :000000 100644 0000000... 1234567... A file4 |
| 1051 | delete :100644 000000 1234567... 0000000... D file5 |
| 1052 | unmerged :000000 000000 0000000... 0000000... U file6</tt></pre> |
| 1053 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1054 | <div class="para"><p>That is, from the left to the right:</p></div> |
| 1055 | <div class="olist"><ol> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1056 | <li> |
| 1057 | <p> |
| 1058 | a colon. |
| 1059 | </p> |
| 1060 | </li> |
| 1061 | <li> |
| 1062 | <p> |
| 1063 | mode for "src"; 000000 if creation or unmerged. |
| 1064 | </p> |
| 1065 | </li> |
| 1066 | <li> |
| 1067 | <p> |
| 1068 | a space. |
| 1069 | </p> |
| 1070 | </li> |
| 1071 | <li> |
| 1072 | <p> |
| 1073 | mode for "dst"; 000000 if deletion or unmerged. |
| 1074 | </p> |
| 1075 | </li> |
| 1076 | <li> |
| 1077 | <p> |
| 1078 | a space. |
| 1079 | </p> |
| 1080 | </li> |
| 1081 | <li> |
| 1082 | <p> |
| 1083 | sha1 for "src"; 0{40} if creation or unmerged. |
| 1084 | </p> |
| 1085 | </li> |
| 1086 | <li> |
| 1087 | <p> |
| 1088 | a space. |
| 1089 | </p> |
| 1090 | </li> |
| 1091 | <li> |
| 1092 | <p> |
| 1093 | sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree". |
| 1094 | </p> |
| 1095 | </li> |
| 1096 | <li> |
| 1097 | <p> |
| 1098 | a space. |
| 1099 | </p> |
| 1100 | </li> |
| 1101 | <li> |
| 1102 | <p> |
| 1103 | status, followed by optional "score" number. |
| 1104 | </p> |
| 1105 | </li> |
| 1106 | <li> |
| 1107 | <p> |
| 1108 | a tab or a NUL when <em>-z</em> option is used. |
| 1109 | </p> |
| 1110 | </li> |
| 1111 | <li> |
| 1112 | <p> |
| 1113 | path for "src" |
| 1114 | </p> |
| 1115 | </li> |
| 1116 | <li> |
| 1117 | <p> |
| 1118 | a tab or a NUL when <em>-z</em> option is used; only exists for C or R. |
| 1119 | </p> |
| 1120 | </li> |
| 1121 | <li> |
| 1122 | <p> |
| 1123 | path for "dst"; only exists for C or R. |
| 1124 | </p> |
| 1125 | </li> |
| 1126 | <li> |
| 1127 | <p> |
| 1128 | an LF or a NUL when <em>-z</em> option is used, to terminate the record. |
| 1129 | </p> |
| 1130 | </li> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1131 | </ol></div> |
Junio C Hamano | aa17c7c | 2008-11-03 04:36:58 | [diff] [blame] | 1132 | <div class="para"><p>Possible status letters are:</p></div> |
| 1133 | <div class="ilist"><ul> |
| 1134 | <li> |
| 1135 | <p> |
| 1136 | A: addition of a file |
| 1137 | </p> |
| 1138 | </li> |
| 1139 | <li> |
| 1140 | <p> |
| 1141 | C: copy of a file into a new one |
| 1142 | </p> |
| 1143 | </li> |
| 1144 | <li> |
| 1145 | <p> |
| 1146 | D: deletion of a file |
| 1147 | </p> |
| 1148 | </li> |
| 1149 | <li> |
| 1150 | <p> |
| 1151 | M: modification of the contents or mode of a file |
| 1152 | </p> |
| 1153 | </li> |
| 1154 | <li> |
| 1155 | <p> |
| 1156 | R: renaming of a file |
| 1157 | </p> |
| 1158 | </li> |
| 1159 | <li> |
| 1160 | <p> |
| 1161 | T: change in the type of the file |
| 1162 | </p> |
| 1163 | </li> |
| 1164 | <li> |
| 1165 | <p> |
| 1166 | U: file is unmerged (you must complete the merge before it can |
| 1167 | be committed) |
| 1168 | </p> |
| 1169 | </li> |
| 1170 | <li> |
| 1171 | <p> |
| 1172 | X: "unknown" change type (most probably a bug, please report it) |
| 1173 | </p> |
| 1174 | </li> |
| 1175 | </ul></div> |
Junio C Hamano | 54bf1e2 | 2008-12-20 06:30:11 | [diff] [blame] | 1176 | <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] | 1177 | percentage of similarity between the source and target of the move or |
| 1178 | copy), and are the only ones to be so.</p></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1179 | <div class="para"><p><sha1> is shown as all 0's if a file is new on the filesystem |
| 1180 | and it is out of sync with the index.</p></div> |
| 1181 | <div class="para"><p>Example:</p></div> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1182 | <div class="listingblock"> |
| 1183 | <div class="content"> |
| 1184 | <pre><tt>:100644 100644 5be4a4...... 000000...... M file.c</tt></pre> |
| 1185 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1186 | <div class="para"><p>When <tt>-z</tt> option is not used, TAB, LF, and backslash characters |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1187 | in pathnames are represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>, |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1188 | respectively.</p></div> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1189 | </div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1190 | <h2 id="_diff_format_for_merges">diff format for merges</h2> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1191 | <div class="sectionbody"> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1192 | <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] | 1193 | can take <em>-c</em> or <em>--cc</em> option |
| 1194 | to generate diff output also for merge commits. The output differs |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1195 | from the format described above in the following way:</p></div> |
| 1196 | <div class="olist"><ol> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1197 | <li> |
| 1198 | <p> |
| 1199 | there is a colon for each parent |
| 1200 | </p> |
| 1201 | </li> |
| 1202 | <li> |
| 1203 | <p> |
| 1204 | there are more "src" modes and "src" sha1 |
| 1205 | </p> |
| 1206 | </li> |
| 1207 | <li> |
| 1208 | <p> |
| 1209 | status is concatenated status characters for each parent |
| 1210 | </p> |
| 1211 | </li> |
| 1212 | <li> |
| 1213 | <p> |
| 1214 | no optional "score" number |
| 1215 | </p> |
| 1216 | </li> |
| 1217 | <li> |
| 1218 | <p> |
| 1219 | single path, only for "dst" |
| 1220 | </p> |
| 1221 | </li> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1222 | </ol></div> |
| 1223 | <div class="para"><p>Example:</p></div> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1224 | <div class="listingblock"> |
| 1225 | <div class="content"> |
| 1226 | <pre><tt>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</tt></pre> |
| 1227 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1228 | <div class="para"><p>Note that <em>combined diff</em> lists only files which were modified from |
| 1229 | all parents.</p></div> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1230 | </div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1231 | <h2 id="_generating_patches_with_p">Generating patches with -p</h2> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1232 | <div class="sectionbody"> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1233 | <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] | 1234 | with a <em>-p</em> option, "git diff" without the <em>--raw</em> option, or |
| 1235 | "git log" with the "-p" option, they |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1236 | do not produce the output described above; instead they produce a |
| 1237 | patch file. You can customize the creation of such patches via the |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1238 | GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p></div> |
| 1239 | <div class="para"><p>What the -p option produces is slightly different from the traditional |
| 1240 | diff format.</p></div> |
| 1241 | <div class="olist"><ol> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1242 | <li> |
| 1243 | <p> |
| 1244 | It is preceded with a "git diff" header, that looks like |
| 1245 | this: |
| 1246 | </p> |
| 1247 | <div class="literalblock"> |
| 1248 | <div class="content"> |
| 1249 | <pre><tt>diff --git a/file1 b/file2</tt></pre> |
| 1250 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1251 | <div class="para"><p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1252 | involved. Especially, even for a creation or a deletion, |
Junio C Hamano | e1b2683 | 2009-11-15 10:02:56 | [diff] [blame] | 1253 | <tt>/dev/null</tt> is _not_ used in place of <tt>a/</tt> or <tt>b/</tt> filenames.</p></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1254 | <div class="para"><p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1255 | name of the source file of the rename/copy and the name of |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1256 | the file that rename/copy produces, respectively.</p></div> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1257 | </li> |
| 1258 | <li> |
| 1259 | <p> |
| 1260 | It is followed by one or more extended header lines: |
| 1261 | </p> |
| 1262 | <div class="literalblock"> |
| 1263 | <div class="content"> |
| 1264 | <pre><tt>old mode <mode> |
| 1265 | new mode <mode> |
| 1266 | deleted file mode <mode> |
| 1267 | new file mode <mode> |
| 1268 | copy from <path> |
| 1269 | copy to <path> |
| 1270 | rename from <path> |
| 1271 | rename to <path> |
| 1272 | similarity index <number> |
| 1273 | dissimilarity index <number> |
| 1274 | index <hash>..<hash> <mode></tt></pre> |
| 1275 | </div></div> |
| 1276 | </li> |
| 1277 | <li> |
| 1278 | <p> |
| 1279 | TAB, LF, double quote and backslash characters in pathnames |
| 1280 | are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and <tt>\\</tt>, respectively. |
| 1281 | If there is need for such substitution then the whole |
| 1282 | pathname is put in double quotes. |
| 1283 | </p> |
| 1284 | </li> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1285 | </ol></div> |
| 1286 | <div class="para"><p>The similarity index is the percentage of unchanged lines, and |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1287 | the dissimilarity index is the percentage of changed lines. It |
| 1288 | is a rounded down integer, followed by a percent sign. The |
| 1289 | similarity index value of 100% is thus reserved for two equal |
| 1290 | files, while 100% dissimilarity means that no line from the old |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1291 | file made it into the new one.</p></div> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1292 | </div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1293 | <h2 id="_combined_diff_format">combined diff format</h2> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1294 | <div class="sectionbody"> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1295 | <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] | 1296 | <em>--cc</em> option to produce <em>combined diff</em>. For showing a merge commit |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 1297 | with "git log -p", this is the default format; you can force showing |
| 1298 | full diff with the <em>-m</em> option. |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1299 | A <em>combined diff</em> format looks like this:</p></div> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1300 | <div class="listingblock"> |
| 1301 | <div class="content"> |
| 1302 | <pre><tt>diff --combined describe.c |
| 1303 | index fabadb8,cc95eb0..4866510 |
| 1304 | --- a/describe.c |
| 1305 | +++ b/describe.c |
| 1306 | @@@ -98,20 -98,12 +98,20 @@@ |
| 1307 | return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1; |
| 1308 | } |
| 1309 | |
| 1310 | - static void describe(char *arg) |
| 1311 | -static void describe(struct commit *cmit, int last_one) |
| 1312 | ++static void describe(char *arg, int last_one) |
| 1313 | { |
| 1314 | + unsigned char sha1[20]; |
| 1315 | + struct commit *cmit; |
| 1316 | struct commit_list *list; |
| 1317 | static int initialized = 0; |
| 1318 | struct commit_name *n; |
| 1319 | |
| 1320 | + if (get_sha1(arg, sha1) < 0) |
| 1321 | + usage(describe_usage); |
| 1322 | + cmit = lookup_commit_reference(sha1); |
| 1323 | + if (!cmit) |
| 1324 | + usage(describe_usage); |
| 1325 | + |
| 1326 | if (!initialized) { |
| 1327 | initialized = 1; |
| 1328 | for_each_ref(get_name);</tt></pre> |
| 1329 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1330 | <div class="olist"><ol> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1331 | <li> |
| 1332 | <p> |
| 1333 | It is preceded with a "git diff" header, that looks like |
| 1334 | this (when <em>-c</em> option is used): |
| 1335 | </p> |
| 1336 | <div class="literalblock"> |
| 1337 | <div class="content"> |
| 1338 | <pre><tt>diff --combined file</tt></pre> |
| 1339 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1340 | <div class="para"><p>or like this (when <em>--cc</em> option is used):</p></div> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1341 | <div class="literalblock"> |
| 1342 | <div class="content"> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1343 | <pre><tt>diff --cc file</tt></pre> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1344 | </div></div> |
| 1345 | </li> |
| 1346 | <li> |
| 1347 | <p> |
| 1348 | It is followed by one or more extended header lines |
| 1349 | (this example shows a merge with two parents): |
| 1350 | </p> |
| 1351 | <div class="literalblock"> |
| 1352 | <div class="content"> |
| 1353 | <pre><tt>index <hash>,<hash>..<hash> |
| 1354 | mode <mode>,<mode>..<mode> |
| 1355 | new file mode <mode> |
| 1356 | deleted file mode <mode>,<mode></tt></pre> |
| 1357 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1358 | <div class="para"><p>The <tt>mode <mode>,<mode>..<mode></tt> line appears only if at least one of |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1359 | the <mode> is different from the rest. Extended headers with |
| 1360 | information about detected contents movement (renames and |
| 1361 | copying detection) are designed to work with diff of two |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1362 | <tree-ish> and are not used by combined diff format.</p></div> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1363 | </li> |
| 1364 | <li> |
| 1365 | <p> |
| 1366 | It is followed by two-line from-file/to-file header |
| 1367 | </p> |
| 1368 | <div class="literalblock"> |
| 1369 | <div class="content"> |
| 1370 | <pre><tt>--- a/file |
| 1371 | +++ b/file</tt></pre> |
| 1372 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1373 | <div class="para"><p>Similar to two-line header for traditional <em>unified</em> diff |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1374 | format, <tt>/dev/null</tt> is used to signal created or deleted |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1375 | files.</p></div> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1376 | </li> |
| 1377 | <li> |
| 1378 | <p> |
| 1379 | Chunk header format is modified to prevent people from |
| 1380 | accidentally feeding it to <tt>patch -p1</tt>. Combined diff format |
| 1381 | was created for review of merge commit changes, and was not |
| 1382 | meant for apply. The change is similar to the change in the |
| 1383 | extended <em>index</em> header: |
| 1384 | </p> |
| 1385 | <div class="literalblock"> |
| 1386 | <div class="content"> |
| 1387 | <pre><tt>@@@ <from-file-range> <from-file-range> <to-file-range> @@@</tt></pre> |
| 1388 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1389 | <div class="para"><p>There are (number of parents + 1) <tt>@</tt> characters in the chunk |
| 1390 | header for combined diff format.</p></div> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1391 | </li> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1392 | </ol></div> |
| 1393 | <div class="para"><p>Unlike the traditional <em>unified</em> diff format, which shows two |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1394 | files A and B with a single column that has <tt>-</tt> (minus — |
| 1395 | appears in A but removed in B), <tt>+</tt> (plus — missing in A but |
| 1396 | added to B), or <tt>" "</tt> (space — unchanged) prefix, this format |
| 1397 | compares two or more files file1, file2,… with one file X, and |
| 1398 | shows how X differs from each of fileN. One column for each of |
| 1399 | fileN is prepended to the output line to note how X's line is |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1400 | different from it.</p></div> |
| 1401 | <div class="para"><p>A <tt>-</tt> character in the column N means that the line appears in |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1402 | 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] | 1403 | in the column N means that the line appears in the result, |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1404 | and fileN does not have that line (in other words, the line was |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1405 | added, from the point of view of that parent).</p></div> |
| 1406 | <div class="para"><p>In the above example output, the function signature was changed |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1407 | from both files (hence two <tt>-</tt> removals from both file1 and |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 1408 | 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] | 1409 | in either file1 nor file2). Also eight other lines are the same |
| 1410 | from file1 but do not appear in file2 (hence prefixed with <tt>+</tt>).</p></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1411 | <div class="para"><p>When shown by <tt>git diff-tree -c</tt>, it compares the parents of a |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1412 | merge commit with the merge result (i.e. file1..fileN are the |
| 1413 | parents). When shown by <tt>git diff-files -c</tt>, it compares the |
| 1414 | two unresolved merge parents with the working tree file |
| 1415 | (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1416 | "their version").</p></div> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1417 | </div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1418 | <h2 id="_other_diff_formats">other diff formats</h2> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 1419 | <div class="sectionbody"> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1420 | <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] | 1421 | copied files. The <tt>--stat</tt> option adds diffstat(1) graph to the |
| 1422 | output. These options can be combined with other options, such as |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1423 | <tt>-p</tt>, and are meant for human consumption.</p></div> |
| 1424 | <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] | 1425 | formats the pathnames compactly by combining common prefix and suffix of |
| 1426 | the pathnames. For example, a change that moves <tt>arch/i386/Makefile</tt> to |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1427 | <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] | 1428 | <div class="listingblock"> |
| 1429 | <div class="content"> |
| 1430 | <pre><tt>arch/{i386 => x86}/Makefile | 4 +--</tt></pre> |
| 1431 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1432 | <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] | 1433 | for easier machine consumption. An entry in <tt>--numstat</tt> output looks |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1434 | like this:</p></div> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 1435 | <div class="listingblock"> |
| 1436 | <div class="content"> |
| 1437 | <pre><tt>1 2 README |
| 1438 | 3 1 arch/{i386 => x86}/Makefile</tt></pre> |
| 1439 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1440 | <div class="para"><p>That is, from left to right:</p></div> |
| 1441 | <div class="olist"><ol> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 1442 | <li> |
| 1443 | <p> |
| 1444 | the number of added lines; |
| 1445 | </p> |
| 1446 | </li> |
| 1447 | <li> |
| 1448 | <p> |
| 1449 | a tab; |
| 1450 | </p> |
| 1451 | </li> |
| 1452 | <li> |
| 1453 | <p> |
| 1454 | the number of deleted lines; |
| 1455 | </p> |
| 1456 | </li> |
| 1457 | <li> |
| 1458 | <p> |
| 1459 | a tab; |
| 1460 | </p> |
| 1461 | </li> |
| 1462 | <li> |
| 1463 | <p> |
| 1464 | pathname (possibly with rename/copy information); |
| 1465 | </p> |
| 1466 | </li> |
| 1467 | <li> |
| 1468 | <p> |
| 1469 | a newline. |
| 1470 | </p> |
| 1471 | </li> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1472 | </ol></div> |
| 1473 | <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] | 1474 | <div class="listingblock"> |
| 1475 | <div class="content"> |
| 1476 | <pre><tt>1 2 README NUL |
| 1477 | 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</tt></pre> |
| 1478 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1479 | <div class="para"><p>That is:</p></div> |
| 1480 | <div class="olist"><ol> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 1481 | <li> |
| 1482 | <p> |
| 1483 | the number of added lines; |
| 1484 | </p> |
| 1485 | </li> |
| 1486 | <li> |
| 1487 | <p> |
| 1488 | a tab; |
| 1489 | </p> |
| 1490 | </li> |
| 1491 | <li> |
| 1492 | <p> |
| 1493 | the number of deleted lines; |
| 1494 | </p> |
| 1495 | </li> |
| 1496 | <li> |
| 1497 | <p> |
| 1498 | a tab; |
| 1499 | </p> |
| 1500 | </li> |
| 1501 | <li> |
| 1502 | <p> |
| 1503 | a NUL (only exists if renamed/copied); |
| 1504 | </p> |
| 1505 | </li> |
| 1506 | <li> |
| 1507 | <p> |
| 1508 | pathname in preimage; |
| 1509 | </p> |
| 1510 | </li> |
| 1511 | <li> |
| 1512 | <p> |
| 1513 | a NUL (only exists if renamed/copied); |
| 1514 | </p> |
| 1515 | </li> |
| 1516 | <li> |
| 1517 | <p> |
| 1518 | pathname in postimage (only exists if renamed/copied); |
| 1519 | </p> |
| 1520 | </li> |
| 1521 | <li> |
| 1522 | <p> |
| 1523 | a NUL. |
| 1524 | </p> |
| 1525 | </li> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1526 | </ol></div> |
| 1527 | <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] | 1528 | scripts that read the output to tell if the current record being read is |
| 1529 | a single-path record or a rename/copy record without reading ahead. |
| 1530 | After reading added and deleted lines, reading up to <tt>NUL</tt> would yield |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1531 | 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] | 1532 | </div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1533 | <h2 id="_examples">EXAMPLES</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1534 | <div class="sectionbody"> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1535 | <div class="vlist"><dl> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1536 | <dt> |
| 1537 | Various ways to check your working tree |
| 1538 | </dt> |
| 1539 | <dd> |
| 1540 | <div class="listingblock"> |
| 1541 | <div class="content"> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1542 | <pre><tt>$ git diff <b>(1)</b> |
Junio C Hamano | 47848ae | 2006-12-14 11:20:06 | [diff] [blame] | 1543 | $ git diff --cached <b>(2)</b> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1544 | $ git diff HEAD <b>(3)</b></tt></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1545 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1546 | <div class="colist"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1547 | <li> |
| 1548 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 1549 | Changes in the working tree not yet staged for the next commit. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1550 | </p> |
| 1551 | </li> |
| 1552 | <li> |
| 1553 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 1554 | Changes between the index and your last commit; what you |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1555 | would be committing if you run "git commit" without "-a" option. |
| 1556 | </p> |
| 1557 | </li> |
| 1558 | <li> |
| 1559 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 1560 | Changes in the working tree since your last commit; what you |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1561 | would be committing if you run "git commit -a" |
| 1562 | </p> |
| 1563 | </li> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1564 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1565 | </dd> |
| 1566 | <dt> |
| 1567 | Comparing with arbitrary commits |
| 1568 | </dt> |
| 1569 | <dd> |
| 1570 | <div class="listingblock"> |
| 1571 | <div class="content"> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1572 | <pre><tt>$ git diff test <b>(1)</b> |
| 1573 | $ git diff HEAD -- ./test <b>(2)</b> |
| 1574 | $ git diff HEAD^ HEAD <b>(3)</b></tt></pre> |
| 1575 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1576 | <div class="colist"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1577 | <li> |
| 1578 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 1579 | Instead of using the tip of the current branch, compare with the |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1580 | tip of "test" branch. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1581 | </p> |
| 1582 | </li> |
| 1583 | <li> |
| 1584 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 1585 | Instead of comparing with the tip of "test" branch, compare with |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 1586 | the tip of the current branch, but limit the comparison to the |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1587 | file "test". |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1588 | </p> |
| 1589 | </li> |
| 1590 | <li> |
| 1591 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 1592 | Compare the version before the last commit and the last commit. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1593 | </p> |
| 1594 | </li> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1595 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1596 | </dd> |
| 1597 | <dt> |
Junio C Hamano | c435b1c | 2007-08-28 06:25:35 | [diff] [blame] | 1598 | Comparing branches |
| 1599 | </dt> |
| 1600 | <dd> |
| 1601 | <div class="listingblock"> |
| 1602 | <div class="content"> |
| 1603 | <pre><tt>$ git diff topic master <b>(1)</b> |
| 1604 | $ git diff topic..master <b>(2)</b> |
| 1605 | $ git diff topic...master <b>(3)</b></tt></pre> |
| 1606 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1607 | <div class="colist"><ol> |
Junio C Hamano | c435b1c | 2007-08-28 06:25:35 | [diff] [blame] | 1608 | <li> |
| 1609 | <p> |
| 1610 | Changes between the tips of the topic and the master branches. |
| 1611 | </p> |
| 1612 | </li> |
| 1613 | <li> |
| 1614 | <p> |
| 1615 | Same as above. |
| 1616 | </p> |
| 1617 | </li> |
| 1618 | <li> |
| 1619 | <p> |
Junio C Hamano | 764a667 | 2007-10-23 01:23:31 | [diff] [blame] | 1620 | Changes that occurred on the master branch since when the topic |
Junio C Hamano | c435b1c | 2007-08-28 06:25:35 | [diff] [blame] | 1621 | branch was started off it. |
| 1622 | </p> |
| 1623 | </li> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1624 | </ol></div> |
Junio C Hamano | c435b1c | 2007-08-28 06:25:35 | [diff] [blame] | 1625 | </dd> |
| 1626 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1627 | Limiting the diff output |
| 1628 | </dt> |
| 1629 | <dd> |
| 1630 | <div class="listingblock"> |
| 1631 | <div class="content"> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1632 | <pre><tt>$ git diff --diff-filter=MRC <b>(1)</b> |
Junio C Hamano | bdeff82 | 2007-07-30 09:07:17 | [diff] [blame] | 1633 | $ git diff --name-status <b>(2)</b> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1634 | $ git diff arch/i386 include/asm-i386 <b>(3)</b></tt></pre> |
| 1635 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1636 | <div class="colist"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1637 | <li> |
| 1638 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 1639 | Show only modification, rename and copy, but not addition |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1640 | nor deletion. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1641 | </p> |
| 1642 | </li> |
| 1643 | <li> |
| 1644 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 1645 | Show only names and the nature of change, but not actual |
Junio C Hamano | bdeff82 | 2007-07-30 09:07:17 | [diff] [blame] | 1646 | diff output. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1647 | </p> |
| 1648 | </li> |
| 1649 | <li> |
| 1650 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 1651 | Limit diff output to named subtrees. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1652 | </p> |
| 1653 | </li> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1654 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1655 | </dd> |
| 1656 | <dt> |
| 1657 | Munging the diff output |
| 1658 | </dt> |
| 1659 | <dd> |
| 1660 | <div class="listingblock"> |
| 1661 | <div class="content"> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1662 | <pre><tt>$ git diff --find-copies-harder -B -C <b>(1)</b> |
| 1663 | $ git diff -R <b>(2)</b></tt></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1664 | </div></div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1665 | <div class="colist"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1666 | <li> |
| 1667 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 1668 | Spend extra cycles to find renames, copies and complete |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1669 | rewrites (very expensive). |
| 1670 | </p> |
| 1671 | </li> |
| 1672 | <li> |
| 1673 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 1674 | Output diff in reverse. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1675 | </p> |
| 1676 | </li> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1677 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1678 | </dd> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1679 | </dl></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1680 | </div> |
Junio C Hamano | a9701f0 | 2010-01-21 00:42:16 | [diff] [blame] | 1681 | <h2 id="_see_also">SEE ALSO</h2> |
| 1682 | <div class="sectionbody"> |
| 1683 | <div class="vlist"><dl> |
| 1684 | <dt> |
| 1685 | <a href="git-difftool.html">git-difftool(1)</a> |
| 1686 | </dt> |
| 1687 | <dd> |
| 1688 | <p> |
| 1689 | Show changes using common diff tools |
| 1690 | </p> |
| 1691 | </dd> |
| 1692 | </dl></div> |
| 1693 | </div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1694 | <h2 id="_author">Author</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1695 | <div class="sectionbody"> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1696 | <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] | 1697 | </div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1698 | <h2 id="_documentation">Documentation</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1699 | <div class="sectionbody"> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1700 | <div class="para"><p>Documentation by 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] | 1701 | </div> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1702 | <h2 id="_git">GIT</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1703 | <div class="sectionbody"> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1704 | <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] | 1705 | </div> |
| 1706 | <div id="footer"> |
| 1707 | <div id="footer-text"> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame^] | 1708 | Last updated 2010-05-21 14:57:17 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1709 | </div> |
| 1710 | </div> |
| 1711 | </body> |
| 1712 | </html> |