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> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 5 | <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 8.6.9" /> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 7 | <title>git-diff-index(1)</title> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 8 | <style type="text/css"> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 9 | /* Shared CSS for AsciiDoc xhtml11 and html5 backends */ |
| 10 | |
| 11 | /* Default font. */ |
| 12 | body { |
| 13 | font-family: Georgia,serif; |
| 14 | } |
| 15 | |
| 16 | /* Title font. */ |
| 17 | h1, h2, h3, h4, h5, h6, |
| 18 | div.title, caption.title, |
| 19 | thead, p.table.header, |
| 20 | #toctitle, |
| 21 | #author, #revnumber, #revdate, #revremark, |
| 22 | #footer { |
| 23 | font-family: Arial,Helvetica,sans-serif; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | body { |
| 27 | margin: 1em 5% 1em 5%; |
| 28 | } |
| 29 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 30 | a { |
| 31 | color: blue; |
| 32 | text-decoration: underline; |
| 33 | } |
| 34 | a:visited { |
| 35 | color: fuchsia; |
| 36 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 37 | |
| 38 | em { |
| 39 | font-style: italic; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 40 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | strong { |
| 44 | font-weight: bold; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 45 | color: #083194; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 46 | } |
| 47 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 48 | h1, h2, h3, h4, h5, h6 { |
| 49 | color: #527bbd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 50 | margin-top: 1.2em; |
| 51 | margin-bottom: 0.5em; |
| 52 | line-height: 1.3; |
| 53 | } |
| 54 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 55 | h1, h2, h3 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 56 | border-bottom: 2px solid silver; |
| 57 | } |
| 58 | h2 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 59 | padding-top: 0.5em; |
| 60 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 61 | h3 { |
| 62 | float: left; |
| 63 | } |
| 64 | h3 + * { |
| 65 | clear: left; |
| 66 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 67 | h5 { |
| 68 | font-size: 1.0em; |
| 69 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 70 | |
| 71 | div.sectionbody { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 72 | margin-left: 0; |
| 73 | } |
| 74 | |
| 75 | hr { |
| 76 | border: 1px solid silver; |
| 77 | } |
| 78 | |
| 79 | p { |
| 80 | margin-top: 0.5em; |
| 81 | margin-bottom: 0.5em; |
| 82 | } |
| 83 | |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 84 | ul, ol, li > p { |
| 85 | margin-top: 0; |
| 86 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 87 | ul > li { color: #aaa; } |
| 88 | ul > li > * { color: black; } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 89 | |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 90 | .monospaced, code, pre { |
| 91 | font-family: "Courier New", Courier, monospace; |
| 92 | font-size: inherit; |
| 93 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 94 | padding: 0; |
| 95 | margin: 0; |
| 96 | } |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 97 | pre { |
| 98 | white-space: pre-wrap; |
| 99 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 100 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 101 | #author { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 102 | color: #527bbd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 103 | font-weight: bold; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 104 | font-size: 1.1em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 105 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 106 | #email { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 107 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 108 | #revnumber, #revdate, #revremark { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 109 | } |
| 110 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 111 | #footer { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 112 | font-size: small; |
| 113 | border-top: 2px solid silver; |
| 114 | padding-top: 0.5em; |
| 115 | margin-top: 4.0em; |
| 116 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 117 | #footer-text { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 118 | float: left; |
| 119 | padding-bottom: 0.5em; |
| 120 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 121 | #footer-badges { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 122 | float: right; |
| 123 | padding-bottom: 0.5em; |
| 124 | } |
| 125 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 126 | #preamble { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 127 | margin-top: 1.5em; |
| 128 | margin-bottom: 1.5em; |
| 129 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 130 | div.imageblock, div.exampleblock, div.verseblock, |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 131 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 132 | div.admonitionblock { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 133 | margin-top: 1.0em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 134 | margin-bottom: 1.5em; |
| 135 | } |
| 136 | div.admonitionblock { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 137 | margin-top: 2.0em; |
| 138 | margin-bottom: 2.0em; |
| 139 | margin-right: 10%; |
| 140 | color: #606060; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | div.content { /* Block element content. */ |
| 144 | padding: 0; |
| 145 | } |
| 146 | |
| 147 | /* Block element titles. */ |
| 148 | div.title, caption.title { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 149 | color: #527bbd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 150 | font-weight: bold; |
| 151 | text-align: left; |
| 152 | margin-top: 1.0em; |
| 153 | margin-bottom: 0.5em; |
| 154 | } |
| 155 | div.title + * { |
| 156 | margin-top: 0; |
| 157 | } |
| 158 | |
| 159 | td div.title:first-child { |
| 160 | margin-top: 0.0em; |
| 161 | } |
| 162 | div.content div.title:first-child { |
| 163 | margin-top: 0.0em; |
| 164 | } |
| 165 | div.content + div.title { |
| 166 | margin-top: 0.0em; |
| 167 | } |
| 168 | |
| 169 | div.sidebarblock > div.content { |
| 170 | background: #ffffee; |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 171 | border: 1px solid #dddddd; |
| 172 | border-left: 4px solid #f0f0f0; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 173 | padding: 0.5em; |
| 174 | } |
| 175 | |
| 176 | div.listingblock > div.content { |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 177 | border: 1px solid #dddddd; |
| 178 | border-left: 5px solid #f0f0f0; |
| 179 | background: #f8f8f8; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 180 | padding: 0.5em; |
| 181 | } |
| 182 | |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 183 | div.quoteblock, div.verseblock { |
| 184 | padding-left: 1.0em; |
| 185 | margin-left: 1.0em; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 186 | margin-right: 10%; |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 187 | border-left: 5px solid #f0f0f0; |
| 188 | color: #888; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 189 | } |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 190 | |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 191 | div.quoteblock > div.attribution { |
| 192 | padding-top: 0.5em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 193 | text-align: right; |
| 194 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 195 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 196 | div.verseblock > pre.content { |
| 197 | font-family: inherit; |
| 198 | font-size: inherit; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 199 | } |
| 200 | div.verseblock > div.attribution { |
| 201 | padding-top: 0.75em; |
| 202 | text-align: left; |
| 203 | } |
| 204 | /* DEPRECATED: Pre version 8.2.7 verse style literal block. */ |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 205 | div.verseblock + div.attribution { |
| 206 | text-align: left; |
| 207 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 208 | |
| 209 | div.admonitionblock .icon { |
| 210 | vertical-align: top; |
| 211 | font-size: 1.1em; |
| 212 | font-weight: bold; |
| 213 | text-decoration: underline; |
| 214 | color: #527bbd; |
| 215 | padding-right: 0.5em; |
| 216 | } |
| 217 | div.admonitionblock td.content { |
| 218 | padding-left: 0.5em; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 219 | border-left: 3px solid #dddddd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | div.exampleblock > div.content { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 223 | border-left: 3px solid #dddddd; |
| 224 | padding-left: 0.5em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 225 | } |
| 226 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 227 | div.imageblock div.content { padding-left: 0; } |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 228 | span.image img { border-style: none; vertical-align: text-bottom; } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 229 | a.image:visited { color: white; } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 230 | |
| 231 | dl { |
| 232 | margin-top: 0.8em; |
| 233 | margin-bottom: 0.8em; |
| 234 | } |
| 235 | dt { |
| 236 | margin-top: 0.5em; |
| 237 | margin-bottom: 0; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 238 | font-style: normal; |
| 239 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 240 | } |
| 241 | dd > *:first-child { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 242 | margin-top: 0.1em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | ul, ol { |
| 246 | list-style-position: outside; |
| 247 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 248 | ol.arabic { |
| 249 | list-style-type: decimal; |
| 250 | } |
| 251 | ol.loweralpha { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 252 | list-style-type: lower-alpha; |
| 253 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 254 | ol.upperalpha { |
| 255 | list-style-type: upper-alpha; |
| 256 | } |
| 257 | ol.lowerroman { |
| 258 | list-style-type: lower-roman; |
| 259 | } |
| 260 | ol.upperroman { |
| 261 | list-style-type: upper-roman; |
| 262 | } |
| 263 | |
| 264 | div.compact ul, div.compact ol, |
| 265 | div.compact p, div.compact p, |
| 266 | div.compact div, div.compact div { |
| 267 | margin-top: 0.1em; |
| 268 | margin-bottom: 0.1em; |
| 269 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 270 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 271 | tfoot { |
| 272 | font-weight: bold; |
| 273 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 274 | td > div.verse { |
| 275 | white-space: pre; |
| 276 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 277 | |
| 278 | div.hdlist { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 279 | margin-top: 0.8em; |
| 280 | margin-bottom: 0.8em; |
| 281 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 282 | div.hdlist tr { |
| 283 | padding-bottom: 15px; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 284 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 285 | dt.hdlist1.strong, td.hdlist1.strong { |
| 286 | font-weight: bold; |
| 287 | } |
| 288 | td.hdlist1 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 289 | vertical-align: top; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 290 | font-style: normal; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 291 | padding-right: 0.8em; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 292 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 293 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 294 | td.hdlist2 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 295 | vertical-align: top; |
| 296 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 297 | div.hdlist.compact tr { |
| 298 | margin: 0; |
| 299 | padding-bottom: 0; |
| 300 | } |
| 301 | |
| 302 | .comment { |
| 303 | background: yellow; |
| 304 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 305 | |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 306 | .footnote, .footnoteref { |
| 307 | font-size: 0.8em; |
| 308 | } |
| 309 | |
| 310 | span.footnote, span.footnoteref { |
| 311 | vertical-align: super; |
| 312 | } |
| 313 | |
| 314 | #footnotes { |
| 315 | margin: 20px 0 20px 0; |
| 316 | padding: 7px 0 0 0; |
| 317 | } |
| 318 | |
| 319 | #footnotes div.footnote { |
| 320 | margin: 0 0 5px 0; |
| 321 | } |
| 322 | |
| 323 | #footnotes hr { |
| 324 | border: none; |
| 325 | border-top: 1px solid silver; |
| 326 | height: 1px; |
| 327 | text-align: left; |
| 328 | margin-left: 0; |
| 329 | width: 20%; |
| 330 | min-width: 100px; |
| 331 | } |
| 332 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 333 | div.colist td { |
| 334 | padding-right: 0.5em; |
| 335 | padding-bottom: 0.3em; |
| 336 | vertical-align: top; |
| 337 | } |
| 338 | div.colist td img { |
| 339 | margin-top: 0.3em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 340 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 341 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 342 | @media print { |
| 343 | #footer-badges { display: none; } |
| 344 | } |
| 345 | |
| 346 | #toc { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 347 | margin-bottom: 2.5em; |
| 348 | } |
| 349 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 350 | #toctitle { |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 351 | color: #527bbd; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 352 | font-size: 1.1em; |
| 353 | font-weight: bold; |
| 354 | margin-top: 1.0em; |
| 355 | margin-bottom: 0.1em; |
| 356 | } |
| 357 | |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 358 | div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 359 | margin-top: 0; |
| 360 | margin-bottom: 0; |
| 361 | } |
| 362 | div.toclevel2 { |
| 363 | margin-left: 2em; |
| 364 | font-size: 0.9em; |
| 365 | } |
| 366 | div.toclevel3 { |
| 367 | margin-left: 4em; |
| 368 | font-size: 0.9em; |
| 369 | } |
| 370 | div.toclevel4 { |
| 371 | margin-left: 6em; |
| 372 | font-size: 0.9em; |
| 373 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 374 | |
| 375 | span.aqua { color: aqua; } |
| 376 | span.black { color: black; } |
| 377 | span.blue { color: blue; } |
| 378 | span.fuchsia { color: fuchsia; } |
| 379 | span.gray { color: gray; } |
| 380 | span.green { color: green; } |
| 381 | span.lime { color: lime; } |
| 382 | span.maroon { color: maroon; } |
| 383 | span.navy { color: navy; } |
| 384 | span.olive { color: olive; } |
| 385 | span.purple { color: purple; } |
| 386 | span.red { color: red; } |
| 387 | span.silver { color: silver; } |
| 388 | span.teal { color: teal; } |
| 389 | span.white { color: white; } |
| 390 | span.yellow { color: yellow; } |
| 391 | |
| 392 | span.aqua-background { background: aqua; } |
| 393 | span.black-background { background: black; } |
| 394 | span.blue-background { background: blue; } |
| 395 | span.fuchsia-background { background: fuchsia; } |
| 396 | span.gray-background { background: gray; } |
| 397 | span.green-background { background: green; } |
| 398 | span.lime-background { background: lime; } |
| 399 | span.maroon-background { background: maroon; } |
| 400 | span.navy-background { background: navy; } |
| 401 | span.olive-background { background: olive; } |
| 402 | span.purple-background { background: purple; } |
| 403 | span.red-background { background: red; } |
| 404 | span.silver-background { background: silver; } |
| 405 | span.teal-background { background: teal; } |
| 406 | span.white-background { background: white; } |
| 407 | span.yellow-background { background: yellow; } |
| 408 | |
| 409 | span.big { font-size: 2em; } |
| 410 | span.small { font-size: 0.6em; } |
| 411 | |
| 412 | span.underline { text-decoration: underline; } |
| 413 | span.overline { text-decoration: overline; } |
| 414 | span.line-through { text-decoration: line-through; } |
| 415 | |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 416 | div.unbreakable { page-break-inside: avoid; } |
| 417 | |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 418 | |
| 419 | /* |
| 420 | * xhtml11 specific |
| 421 | * |
| 422 | * */ |
| 423 | |
| 424 | div.tableblock { |
| 425 | margin-top: 1.0em; |
| 426 | margin-bottom: 1.5em; |
| 427 | } |
| 428 | div.tableblock > table { |
| 429 | border: 3px solid #527bbd; |
| 430 | } |
| 431 | thead, p.table.header { |
| 432 | font-weight: bold; |
| 433 | color: #527bbd; |
| 434 | } |
| 435 | p.table { |
| 436 | margin-top: 0; |
| 437 | } |
| 438 | /* Because the table frame attribute is overriden by CSS in most browsers. */ |
| 439 | div.tableblock > table[frame="void"] { |
| 440 | border-style: none; |
| 441 | } |
| 442 | div.tableblock > table[frame="hsides"] { |
| 443 | border-left-style: none; |
| 444 | border-right-style: none; |
| 445 | } |
| 446 | div.tableblock > table[frame="vsides"] { |
| 447 | border-top-style: none; |
| 448 | border-bottom-style: none; |
| 449 | } |
| 450 | |
| 451 | |
| 452 | /* |
| 453 | * html5 specific |
| 454 | * |
| 455 | * */ |
| 456 | |
| 457 | table.tableblock { |
| 458 | margin-top: 1.0em; |
| 459 | margin-bottom: 1.5em; |
| 460 | } |
| 461 | thead, p.tableblock.header { |
| 462 | font-weight: bold; |
| 463 | color: #527bbd; |
| 464 | } |
| 465 | p.tableblock { |
| 466 | margin-top: 0; |
| 467 | } |
| 468 | table.tableblock { |
| 469 | border-width: 3px; |
| 470 | border-spacing: 0px; |
| 471 | border-style: solid; |
| 472 | border-color: #527bbd; |
| 473 | border-collapse: collapse; |
| 474 | } |
| 475 | th.tableblock, td.tableblock { |
| 476 | border-width: 1px; |
| 477 | padding: 4px; |
| 478 | border-style: solid; |
| 479 | border-color: #527bbd; |
| 480 | } |
| 481 | |
| 482 | table.tableblock.frame-topbot { |
| 483 | border-left-style: hidden; |
| 484 | border-right-style: hidden; |
| 485 | } |
| 486 | table.tableblock.frame-sides { |
| 487 | border-top-style: hidden; |
| 488 | border-bottom-style: hidden; |
| 489 | } |
| 490 | table.tableblock.frame-none { |
| 491 | border-style: hidden; |
| 492 | } |
| 493 | |
| 494 | th.tableblock.halign-left, td.tableblock.halign-left { |
| 495 | text-align: left; |
| 496 | } |
| 497 | th.tableblock.halign-center, td.tableblock.halign-center { |
| 498 | text-align: center; |
| 499 | } |
| 500 | th.tableblock.halign-right, td.tableblock.halign-right { |
| 501 | text-align: right; |
| 502 | } |
| 503 | |
| 504 | th.tableblock.valign-top, td.tableblock.valign-top { |
| 505 | vertical-align: top; |
| 506 | } |
| 507 | th.tableblock.valign-middle, td.tableblock.valign-middle { |
| 508 | vertical-align: middle; |
| 509 | } |
| 510 | th.tableblock.valign-bottom, td.tableblock.valign-bottom { |
| 511 | vertical-align: bottom; |
| 512 | } |
| 513 | |
| 514 | |
| 515 | /* |
| 516 | * manpage specific |
| 517 | * |
| 518 | * */ |
| 519 | |
| 520 | body.manpage h1 { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 521 | padding-top: 0.5em; |
| 522 | padding-bottom: 0.5em; |
| 523 | border-top: 2px solid silver; |
| 524 | border-bottom: 2px solid silver; |
| 525 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 526 | body.manpage h2 { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 527 | border-style: none; |
| 528 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 529 | body.manpage div.sectionbody { |
| 530 | margin-left: 3em; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 531 | } |
| 532 | |
| 533 | @media print { |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 534 | body.manpage div#toc { display: none; } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 535 | } |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 536 | |
| 537 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 538 | </style> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 539 | <script type="text/javascript"> |
| 540 | /*<![CDATA[*/ |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 541 | var asciidoc = { // Namespace. |
| 542 | |
| 543 | ///////////////////////////////////////////////////////////////////// |
| 544 | // Table Of Contents generator |
| 545 | ///////////////////////////////////////////////////////////////////// |
| 546 | |
| 547 | /* Author: Mihai Bazon, September 2002 |
| 548 | * http://students.infoiasi.ro/~mishoo |
| 549 | * |
| 550 | * Table Of Content generator |
| 551 | * Version: 0.4 |
| 552 | * |
| 553 | * Feel free to use this script under the terms of the GNU General Public |
| 554 | * License, as long as you do not remove or alter this notice. |
| 555 | */ |
| 556 | |
| 557 | /* modified by Troy D. Hanson, September 2006. License: GPL */ |
| 558 | /* modified by Stuart Rackham, 2006, 2009. License: GPL */ |
| 559 | |
| 560 | // toclevels = 1..4. |
| 561 | toc: function (toclevels) { |
| 562 | |
| 563 | function getText(el) { |
| 564 | var text = ""; |
| 565 | for (var i = el.firstChild; i != null; i = i.nextSibling) { |
| 566 | if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants. |
| 567 | text += i.data; |
| 568 | else if (i.firstChild != null) |
| 569 | text += getText(i); |
| 570 | } |
| 571 | return text; |
| 572 | } |
| 573 | |
| 574 | function TocEntry(el, text, toclevel) { |
| 575 | this.element = el; |
| 576 | this.text = text; |
| 577 | this.toclevel = toclevel; |
| 578 | } |
| 579 | |
| 580 | function tocEntries(el, toclevels) { |
| 581 | var result = new Array; |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 582 | var re = new RegExp('[hH]([1-'+(toclevels+1)+'])'); |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 583 | // Function that scans the DOM tree for header elements (the DOM2 |
| 584 | // nodeIterator API would be a better technique but not supported by all |
| 585 | // browsers). |
| 586 | var iterate = function (el) { |
| 587 | for (var i = el.firstChild; i != null; i = i.nextSibling) { |
| 588 | if (i.nodeType == 1 /* Node.ELEMENT_NODE */) { |
| 589 | var mo = re.exec(i.tagName); |
| 590 | if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") { |
| 591 | result[result.length] = new TocEntry(i, getText(i), mo[1]-1); |
| 592 | } |
| 593 | iterate(i); |
| 594 | } |
| 595 | } |
| 596 | } |
| 597 | iterate(el); |
| 598 | return result; |
| 599 | } |
| 600 | |
| 601 | var toc = document.getElementById("toc"); |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 602 | if (!toc) { |
| 603 | return; |
| 604 | } |
| 605 | |
| 606 | // Delete existing TOC entries in case we're reloading the TOC. |
| 607 | var tocEntriesToRemove = []; |
| 608 | var i; |
| 609 | for (i = 0; i < toc.childNodes.length; i++) { |
| 610 | var entry = toc.childNodes[i]; |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 611 | if (entry.nodeName.toLowerCase() == 'div' |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 612 | && entry.getAttribute("class") |
| 613 | && entry.getAttribute("class").match(/^toclevel/)) |
| 614 | tocEntriesToRemove.push(entry); |
| 615 | } |
| 616 | for (i = 0; i < tocEntriesToRemove.length; i++) { |
| 617 | toc.removeChild(tocEntriesToRemove[i]); |
| 618 | } |
| 619 | |
| 620 | // Rebuild TOC entries. |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 621 | var entries = tocEntries(document.getElementById("content"), toclevels); |
| 622 | for (var i = 0; i < entries.length; ++i) { |
| 623 | var entry = entries[i]; |
| 624 | if (entry.element.id == "") |
| 625 | entry.element.id = "_toc_" + i; |
| 626 | var a = document.createElement("a"); |
| 627 | a.href = "#" + entry.element.id; |
| 628 | a.appendChild(document.createTextNode(entry.text)); |
| 629 | var div = document.createElement("div"); |
| 630 | div.appendChild(a); |
| 631 | div.className = "toclevel" + entry.toclevel; |
| 632 | toc.appendChild(div); |
| 633 | } |
| 634 | if (entries.length == 0) |
| 635 | toc.parentNode.removeChild(toc); |
| 636 | }, |
| 637 | |
| 638 | |
| 639 | ///////////////////////////////////////////////////////////////////// |
| 640 | // Footnotes generator |
| 641 | ///////////////////////////////////////////////////////////////////// |
| 642 | |
| 643 | /* Based on footnote generation code from: |
| 644 | * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html |
| 645 | */ |
| 646 | |
| 647 | footnotes: function () { |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 648 | // Delete existing footnote entries in case we're reloading the footnodes. |
| 649 | var i; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 650 | var noteholder = document.getElementById("footnotes"); |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 651 | if (!noteholder) { |
| 652 | return; |
| 653 | } |
| 654 | var entriesToRemove = []; |
| 655 | for (i = 0; i < noteholder.childNodes.length; i++) { |
| 656 | var entry = noteholder.childNodes[i]; |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 657 | if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote") |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 658 | entriesToRemove.push(entry); |
| 659 | } |
| 660 | for (i = 0; i < entriesToRemove.length; i++) { |
| 661 | noteholder.removeChild(entriesToRemove[i]); |
| 662 | } |
| 663 | |
| 664 | // Rebuild footnote entries. |
| 665 | var cont = document.getElementById("content"); |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 666 | var spans = cont.getElementsByTagName("span"); |
| 667 | var refs = {}; |
| 668 | var n = 0; |
| 669 | for (i=0; i<spans.length; i++) { |
| 670 | if (spans[i].className == "footnote") { |
| 671 | n++; |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 672 | var note = spans[i].getAttribute("data-note"); |
| 673 | if (!note) { |
| 674 | // Use [\s\S] in place of . so multi-line matches work. |
| 675 | // Because JavaScript has no s (dotall) regex flag. |
| 676 | note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1]; |
| 677 | spans[i].innerHTML = |
| 678 | "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n + |
| 679 | "' title='View footnote' class='footnote'>" + n + "</a>]"; |
| 680 | spans[i].setAttribute("data-note", note); |
| 681 | } |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 682 | noteholder.innerHTML += |
| 683 | "<div class='footnote' id='_footnote_" + n + "'>" + |
| 684 | "<a href='#_footnoteref_" + n + "' title='Return to text'>" + |
| 685 | n + "</a>. " + note + "</div>"; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 686 | var id =spans[i].getAttribute("id"); |
| 687 | if (id != null) refs["#"+id] = n; |
| 688 | } |
| 689 | } |
| 690 | if (n == 0) |
| 691 | noteholder.parentNode.removeChild(noteholder); |
| 692 | else { |
| 693 | // Process footnoterefs. |
| 694 | for (i=0; i<spans.length; i++) { |
| 695 | if (spans[i].className == "footnoteref") { |
| 696 | var href = spans[i].getElementsByTagName("a")[0].getAttribute("href"); |
| 697 | href = href.match(/#.*/)[0]; // Because IE return full URL. |
| 698 | n = refs[href]; |
| 699 | spans[i].innerHTML = |
| 700 | "[<a href='#_footnote_" + n + |
| 701 | "' title='View footnote' class='footnote'>" + n + "</a>]"; |
| 702 | } |
| 703 | } |
| 704 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 705 | }, |
| 706 | |
| 707 | install: function(toclevels) { |
| 708 | var timerId; |
| 709 | |
| 710 | function reinstall() { |
| 711 | asciidoc.footnotes(); |
| 712 | if (toclevels) { |
| 713 | asciidoc.toc(toclevels); |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | function reinstallAndRemoveTimer() { |
| 718 | clearInterval(timerId); |
| 719 | reinstall(); |
| 720 | } |
| 721 | |
| 722 | timerId = setInterval(reinstall, 500); |
| 723 | if (document.addEventListener) |
| 724 | document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false); |
| 725 | else |
| 726 | window.onload = reinstallAndRemoveTimer; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 727 | } |
| 728 | |
| 729 | } |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 730 | asciidoc.install(); |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 731 | /*]]>*/ |
| 732 | </script> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 733 | </head> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 734 | <body class="manpage"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 735 | <div id="header"> |
| 736 | <h1> |
| 737 | git-diff-index(1) Manual Page |
| 738 | </h1> |
| 739 | <h2>NAME</h2> |
| 740 | <div class="sectionbody"> |
| 741 | <p>git-diff-index - |
Junio C Hamano | 7e590a1 | 2013-06-02 23:46:52 | [diff] [blame] | 742 | Compare a tree to the working tree or index |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 743 | </p> |
| 744 | </div> |
| 745 | </div> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 746 | <div id="content"> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 747 | <div class="sect1"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 748 | <h2 id="_synopsis">SYNOPSIS</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 749 | <div class="sectionbody"> |
Junio C Hamano | 15567bc | 2011-07-23 00:51:59 | [diff] [blame] | 750 | <div class="verseblock"> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 751 | <pre class="content"><em>git diff-index</em> [-m] [--cached] [<common diff options>] <tree-ish> [<path>…]</pre> |
| 752 | <div class="attribution"> |
Junio C Hamano | 15567bc | 2011-07-23 00:51:59 | [diff] [blame] | 753 | </div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 754 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 755 | </div> |
| 756 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 757 | <h2 id="_description">DESCRIPTION</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 758 | <div class="sectionbody"> |
Junio C Hamano | 7e590a1 | 2013-06-02 23:46:52 | [diff] [blame] | 759 | <div class="paragraph"><p>Compares the content and mode of the blobs found in a tree object |
| 760 | with the corresponding tracked files in the working tree, or with the |
| 761 | corresponding paths in the index. When <path> arguments are present, |
| 762 | compares only paths matching those patterns. Otherwise all tracked |
| 763 | files are compared.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 764 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 765 | </div> |
| 766 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 767 | <h2 id="_options">OPTIONS</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 768 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 769 | <div class="dlist"><dl> |
| 770 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 771 | -p |
| 772 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 773 | <dt class="hdlist1"> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 774 | -u |
| 775 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 776 | <dt class="hdlist1"> |
Junio C Hamano | e97d577 | 2010-05-19 08:13:58 | [diff] [blame] | 777 | --patch |
| 778 | </dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 779 | <dd> |
| 780 | <p> |
Junio C Hamano | ff97979 | 2007-11-16 10:11:30 | [diff] [blame] | 781 | Generate patch (see section on generating patches). |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 782 | </p> |
| 783 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 784 | <dt class="hdlist1"> |
Junio C Hamano | 58f587a | 2013-07-22 19:20:59 | [diff] [blame] | 785 | -s |
| 786 | </dt> |
| 787 | <dt class="hdlist1"> |
| 788 | --no-patch |
| 789 | </dt> |
| 790 | <dd> |
| 791 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 792 | Suppress diff output. Useful for commands like <code>git show</code> that |
| 793 | show the patch by default, or to cancel the effect of <code>--patch</code>. |
Junio C Hamano | 58f587a | 2013-07-22 19:20:59 | [diff] [blame] | 794 | </p> |
| 795 | </dd> |
| 796 | <dt class="hdlist1"> |
Junio C Hamano | 6936156 | 2007-07-26 02:14:34 | [diff] [blame] | 797 | -U<n> |
| 798 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 799 | <dt class="hdlist1"> |
Junio C Hamano | 6936156 | 2007-07-26 02:14:34 | [diff] [blame] | 800 | --unified=<n> |
| 801 | </dt> |
| 802 | <dd> |
| 803 | <p> |
| 804 | Generate diffs with <n> lines of context instead of |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 805 | the usual three. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 806 | Implies <code>-p</code>. |
Junio C Hamano | 6936156 | 2007-07-26 02:14:34 | [diff] [blame] | 807 | </p> |
| 808 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 809 | <dt class="hdlist1"> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 810 | --raw |
| 811 | </dt> |
| 812 | <dd> |
| 813 | <p> |
Junio C Hamano | 85f1fde | 2015-06-01 20:37:32 | [diff] [blame] | 814 | Generate the diff in raw format. |
Junio C Hamano | 1dbca52 | 2015-05-22 20:48:55 | [diff] [blame] | 815 | This is the default. |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 816 | </p> |
| 817 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 818 | <dt class="hdlist1"> |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 819 | --patch-with-raw |
| 820 | </dt> |
| 821 | <dd> |
| 822 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 823 | Synonym for <code>-p --raw</code>. |
Junio C Hamano | 54559c8 | 2006-04-13 07:45:12 | [diff] [blame] | 824 | </p> |
| 825 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 826 | <dt class="hdlist1"> |
Junio C Hamano | ad70bf0 | 2016-09-26 23:44:27 | [diff] [blame] | 827 | --indent-heuristic |
| 828 | </dt> |
| 829 | <dt class="hdlist1"> |
| 830 | --no-indent-heuristic |
| 831 | </dt> |
| 832 | <dt class="hdlist1"> |
Junio C Hamano | 5f88833 | 2016-06-13 19:28:31 | [diff] [blame] | 833 | --compaction-heuristic |
| 834 | </dt> |
| 835 | <dt class="hdlist1"> |
| 836 | --no-compaction-heuristic |
| 837 | </dt> |
| 838 | <dd> |
| 839 | <p> |
Junio C Hamano | ad70bf0 | 2016-09-26 23:44:27 | [diff] [blame] | 840 | These are to help debugging and tuning experimental heuristics |
| 841 | (which are off by default) that shift diff hunk boundaries to |
| 842 | make patches easier to read. |
Junio C Hamano | 5f88833 | 2016-06-13 19:28:31 | [diff] [blame] | 843 | </p> |
| 844 | </dd> |
| 845 | <dt class="hdlist1"> |
Junio C Hamano | 5a73f30 | 2011-10-14 05:58:34 | [diff] [blame] | 846 | --minimal |
| 847 | </dt> |
| 848 | <dd> |
| 849 | <p> |
| 850 | Spend extra time to make sure the smallest possible |
| 851 | diff is produced. |
| 852 | </p> |
| 853 | </dd> |
| 854 | <dt class="hdlist1"> |
Junio C Hamano | 20d47e3 | 2009-01-26 06:36:02 | [diff] [blame] | 855 | --patience |
| 856 | </dt> |
| 857 | <dd> |
| 858 | <p> |
| 859 | Generate a diff using the "patience diff" algorithm. |
| 860 | </p> |
| 861 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 862 | <dt class="hdlist1"> |
Junio C Hamano | aea9e6b | 2012-03-07 00:17:11 | [diff] [blame] | 863 | --histogram |
| 864 | </dt> |
| 865 | <dd> |
| 866 | <p> |
| 867 | Generate a diff using the "histogram diff" algorithm. |
| 868 | </p> |
| 869 | </dd> |
| 870 | <dt class="hdlist1"> |
Junio C Hamano | 80ad00d | 2013-02-18 00:19:03 | [diff] [blame] | 871 | --diff-algorithm={patience|minimal|histogram|myers} |
| 872 | </dt> |
| 873 | <dd> |
| 874 | <p> |
| 875 | Choose a diff algorithm. The variants are as follows: |
| 876 | </p> |
| 877 | <div class="openblock"> |
| 878 | <div class="content"> |
| 879 | <div class="dlist"><dl> |
| 880 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 881 | <code>default</code>, <code>myers</code> |
Junio C Hamano | 80ad00d | 2013-02-18 00:19:03 | [diff] [blame] | 882 | </dt> |
| 883 | <dd> |
| 884 | <p> |
| 885 | The basic greedy diff algorithm. Currently, this is the default. |
| 886 | </p> |
| 887 | </dd> |
| 888 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 889 | <code>minimal</code> |
Junio C Hamano | 80ad00d | 2013-02-18 00:19:03 | [diff] [blame] | 890 | </dt> |
| 891 | <dd> |
| 892 | <p> |
| 893 | Spend extra time to make sure the smallest possible diff is |
| 894 | produced. |
| 895 | </p> |
| 896 | </dd> |
| 897 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 898 | <code>patience</code> |
Junio C Hamano | 80ad00d | 2013-02-18 00:19:03 | [diff] [blame] | 899 | </dt> |
| 900 | <dd> |
| 901 | <p> |
| 902 | Use "patience diff" algorithm when generating patches. |
| 903 | </p> |
| 904 | </dd> |
| 905 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 906 | <code>histogram</code> |
Junio C Hamano | 80ad00d | 2013-02-18 00:19:03 | [diff] [blame] | 907 | </dt> |
| 908 | <dd> |
| 909 | <p> |
| 910 | This algorithm extends the patience algorithm to "support |
| 911 | low-occurrence common elements". |
| 912 | </p> |
| 913 | </dd> |
| 914 | </dl></div> |
| 915 | </div></div> |
| 916 | <div class="paragraph"><p>For instance, if you configured diff.algorithm variable to a |
| 917 | non-default value and want to use the default one, then you |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 918 | have to use <code>--diff-algorithm=default</code> option.</p></div> |
Junio C Hamano | 80ad00d | 2013-02-18 00:19:03 | [diff] [blame] | 919 | </dd> |
| 920 | <dt class="hdlist1"> |
Junio C Hamano | 4c4b012 | 2011-06-30 01:19:32 | [diff] [blame] | 921 | --stat[=<width>[,<name-width>[,<count>]]] |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 922 | </dt> |
| 923 | <dd> |
| 924 | <p> |
Junio C Hamano | aea9e6b | 2012-03-07 00:17:11 | [diff] [blame] | 925 | Generate a diffstat. By default, as much space as necessary |
| 926 | will be used for the filename part, and the rest for the graph |
| 927 | part. Maximum width defaults to terminal width, or 80 columns |
Junio C Hamano | 7f2b3cb | 2012-06-22 22:42:39 | [diff] [blame] | 928 | if not connected to a terminal, and can be overridden by |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 929 | <code><width></code>. The width of the filename part can be limited by |
| 930 | giving another width <code><name-width></code> after a comma. The width |
Junio C Hamano | aea9e6b | 2012-03-07 00:17:11 | [diff] [blame] | 931 | of the graph part can be limited by using |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 932 | <code>--stat-graph-width=<width></code> (affects all commands generating |
| 933 | a stat graph) or by setting <code>diff.statGraphWidth=<width></code> |
| 934 | (does not affect <code>git format-patch</code>). |
| 935 | By giving a third parameter <code><count></code>, you can limit the |
| 936 | output to the first <code><count></code> lines, followed by <code>...</code> if |
Junio C Hamano | aea9e6b | 2012-03-07 00:17:11 | [diff] [blame] | 937 | there are more. |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 938 | </p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 939 | <div class="paragraph"><p>These parameters can also be set individually with <code>--stat-width=<width></code>, |
| 940 | <code>--stat-name-width=<name-width></code> and <code>--stat-count=<count></code>.</p></div> |
Junio C Hamano | ba7c8d8 | 2006-04-15 06:17:42 | [diff] [blame] | 941 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 942 | <dt class="hdlist1"> |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 943 | --numstat |
| 944 | </dt> |
| 945 | <dd> |
| 946 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 947 | Similar to <code>--stat</code>, but shows number of added and |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 948 | deleted lines in decimal notation and pathname without |
Junio C Hamano | d793de5 | 2006-12-26 09:11:43 | [diff] [blame] | 949 | abbreviation, to make it more machine friendly. For |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 950 | binary files, outputs two <code>-</code> instead of saying |
| 951 | <code>0 0</code>. |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 952 | </p> |
| 953 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 954 | <dt class="hdlist1"> |
Junio C Hamano | 7d23f5e | 2006-12-16 07:44:04 | [diff] [blame] | 955 | --shortstat |
| 956 | </dt> |
| 957 | <dd> |
| 958 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 959 | Output only the last line of the <code>--stat</code> format containing total |
Junio C Hamano | 7d23f5e | 2006-12-16 07:44:04 | [diff] [blame] | 960 | number of modified files, as well as number of added and deleted |
| 961 | lines. |
| 962 | </p> |
| 963 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 964 | <dt class="hdlist1"> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 965 | --dirstat[=<param1,param2,…>] |
Junio C Hamano | 6a45be9 | 2008-04-22 08:19:03 | [diff] [blame] | 966 | </dt> |
| 967 | <dd> |
| 968 | <p> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 969 | Output the distribution of relative amount of changes for each |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 970 | sub-directory. The behavior of <code>--dirstat</code> can be customized by |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 971 | passing it a comma separated list of parameters. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 972 | The defaults are controlled by the <code>diff.dirstat</code> configuration |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 973 | variable (see <a href="git-config.html">git-config(1)</a>). |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 974 | The following parameters are available: |
Junio C Hamano | 6a45be9 | 2008-04-22 08:19:03 | [diff] [blame] | 975 | </p> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 976 | <div class="openblock"> |
| 977 | <div class="content"> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 978 | <div class="dlist"><dl> |
| 979 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 980 | <code>changes</code> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 981 | </dt> |
| 982 | <dd> |
| 983 | <p> |
| 984 | Compute the dirstat numbers by counting the lines that have been |
| 985 | removed from the source, or added to the destination. This ignores |
| 986 | the amount of pure code movements within a file. In other words, |
| 987 | rearranging lines in a file is not counted as much as other changes. |
| 988 | This is the default behavior when no parameter is given. |
| 989 | </p> |
Junio C Hamano | 6a45be9 | 2008-04-22 08:19:03 | [diff] [blame] | 990 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 991 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 992 | <code>lines</code> |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 993 | </dt> |
| 994 | <dd> |
| 995 | <p> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 996 | Compute the dirstat numbers by doing the regular line-based diff |
| 997 | analysis, and summing the removed/added line counts. (For binary |
| 998 | files, count 64-byte chunks instead, since binary files have no |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 999 | natural concept of lines). This is a more expensive <code>--dirstat</code> |
| 1000 | behavior than the <code>changes</code> behavior, but it does count rearranged |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 1001 | lines within a file as much as other changes. The resulting output |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1002 | is consistent with what you get from the other <code>--*stat</code> options. |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 1003 | </p> |
| 1004 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1005 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1006 | <code>files</code> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 1007 | </dt> |
| 1008 | <dd> |
| 1009 | <p> |
| 1010 | Compute the dirstat numbers by counting the number of files changed. |
| 1011 | Each changed file counts equally in the dirstat analysis. This is |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1012 | the computationally cheapest <code>--dirstat</code> behavior, since it does |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 1013 | not have to look at the file contents at all. |
| 1014 | </p> |
| 1015 | </dd> |
| 1016 | <dt class="hdlist1"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1017 | <code>cumulative</code> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 1018 | </dt> |
| 1019 | <dd> |
| 1020 | <p> |
| 1021 | Count changes in a child directory for the parent directory as well. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1022 | Note that when using <code>cumulative</code>, the sum of the percentages |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 1023 | reported may exceed 100%. The default (non-cumulative) behavior can |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1024 | be specified with the <code>noncumulative</code> parameter. |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 1025 | </p> |
| 1026 | </dd> |
| 1027 | <dt class="hdlist1"> |
| 1028 | <limit> |
| 1029 | </dt> |
| 1030 | <dd> |
| 1031 | <p> |
| 1032 | An integer parameter specifies a cut-off percent (3% by default). |
| 1033 | Directories contributing less than this percentage of the changes |
| 1034 | are not shown in the output. |
| 1035 | </p> |
| 1036 | </dd> |
| 1037 | </dl></div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 1038 | </div></div> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 1039 | <div class="paragraph"><p>Example: The following will count changed files, while ignoring |
| 1040 | directories with less than 10% of the total amount of changed files, |
| 1041 | and accumulating child directory counts in the parent directories: |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1042 | <code>--dirstat=files,10,cumulative</code>.</p></div> |
Junio C Hamano | 1c222c5 | 2011-05-13 19:55:32 | [diff] [blame] | 1043 | </dd> |
| 1044 | <dt class="hdlist1"> |
Junio C Hamano | 6959c6c | 2006-05-17 10:34:11 | [diff] [blame] | 1045 | --summary |
| 1046 | </dt> |
| 1047 | <dd> |
| 1048 | <p> |
| 1049 | Output a condensed summary of extended header information |
| 1050 | such as creations, renames and mode changes. |
| 1051 | </p> |
| 1052 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1053 | <dt class="hdlist1"> |
Junio C Hamano | d1308c9 | 2006-04-16 11:01:09 | [diff] [blame] | 1054 | --patch-with-stat |
| 1055 | </dt> |
| 1056 | <dd> |
| 1057 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1058 | Synonym for <code>-p --stat</code>. |
Junio C Hamano | d1308c9 | 2006-04-16 11:01:09 | [diff] [blame] | 1059 | </p> |
| 1060 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1061 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1062 | -z |
| 1063 | </dt> |
| 1064 | <dd> |
| 1065 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1066 | When <code>--raw</code>, <code>--numstat</code>, <code>--name-only</code> or <code>--name-status</code> has been |
Junio C Hamano | 0c053e8 | 2010-04-19 06:46:34 | [diff] [blame] | 1067 | given, do not munge pathnames and use NULs as output field terminators. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1068 | </p> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1069 | <div class="paragraph"><p>Without this option, each pathname output will have TAB, LF, double quotes, |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1070 | and backslash characters replaced with <code>\t</code>, <code>\n</code>, <code>\"</code>, and <code>\\</code>, |
Junio C Hamano | 5706e0b | 2009-11-24 10:54:16 | [diff] [blame] | 1071 | respectively, and the pathname will be enclosed in double quotes if |
| 1072 | any of those replacements occurred.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1073 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1074 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1075 | --name-only |
| 1076 | </dt> |
| 1077 | <dd> |
| 1078 | <p> |
| 1079 | Show only names of changed files. |
| 1080 | </p> |
| 1081 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1082 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1083 | --name-status |
| 1084 | </dt> |
| 1085 | <dd> |
| 1086 | <p> |
Junio C Hamano | a9aee78 | 2008-04-23 16:09:20 | [diff] [blame] | 1087 | Show only names and status of changed files. See the description |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1088 | of the <code>--diff-filter</code> option on what the status letters mean. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1089 | </p> |
| 1090 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1091 | <dt class="hdlist1"> |
Junio C Hamano | c21ab05 | 2009-10-31 04:03:55 | [diff] [blame] | 1092 | --submodule[=<format>] |
| 1093 | </dt> |
| 1094 | <dd> |
| 1095 | <p> |
Junio C Hamano | cd45166 | 2016-09-13 00:54:09 | [diff] [blame] | 1096 | Specify how differences in submodules are shown. When specifying |
| 1097 | <code>--submodule=short</code> the <em>short</em> format is used. This format just |
| 1098 | shows the names of the commits at the beginning and end of the range. |
| 1099 | When <code>--submodule</code> or <code>--submodule=log</code> is specified, the <em>log</em> |
| 1100 | format is used. This format lists the commits in the range like |
| 1101 | <a href="git-submodule.html">git-submodule(1)</a> <code>summary</code> does. When <code>--submodule=diff</code> |
| 1102 | is specified, the <em>diff</em> format is used. This format shows an |
| 1103 | inline diff of the changes in the submodule contents between the |
| 1104 | commit range. Defaults to <code>diff.submodule</code> or the <em>short</em> format |
| 1105 | if the config option is unset. |
Junio C Hamano | c21ab05 | 2009-10-31 04:03:55 | [diff] [blame] | 1106 | </p> |
| 1107 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1108 | <dt class="hdlist1"> |
Junio C Hamano | 4aa0bcc | 2010-03-03 05:13:12 | [diff] [blame] | 1109 | --color[=<when>] |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 1110 | </dt> |
| 1111 | <dd> |
| 1112 | <p> |
| 1113 | Show colored diff. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1114 | <code>--color</code> (i.e. without <em>=<when></em>) is the same as <code>--color=always</code>. |
| 1115 | <em><when></em> can be one of <code>always</code>, <code>never</code>, or <code>auto</code>. |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 1116 | </p> |
| 1117 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1118 | <dt class="hdlist1"> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 1119 | --no-color |
| 1120 | </dt> |
| 1121 | <dd> |
| 1122 | <p> |
Junio C Hamano | 5f2627d | 2011-05-06 20:23:48 | [diff] [blame] | 1123 | Turn off colored diff. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1124 | It is the same as <code>--color=never</code>. |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 1125 | </p> |
| 1126 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1127 | <dt class="hdlist1"> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1128 | --word-diff[=<mode>] |
Junio C Hamano | 85e45fa | 2006-08-13 07:47:41 | [diff] [blame] | 1129 | </dt> |
| 1130 | <dd> |
| 1131 | <p> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1132 | Show a word diff, using the <mode> to delimit changed words. |
| 1133 | By default, words are delimited by whitespace; see |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1134 | <code>--word-diff-regex</code> below. The <mode> defaults to <em>plain</em>, and |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1135 | must be one of: |
Junio C Hamano | 85e45fa | 2006-08-13 07:47:41 | [diff] [blame] | 1136 | </p> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 1137 | <div class="openblock"> |
| 1138 | <div class="content"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1139 | <div class="dlist"><dl> |
| 1140 | <dt class="hdlist1"> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1141 | color |
| 1142 | </dt> |
| 1143 | <dd> |
| 1144 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1145 | Highlight changed words using only colors. Implies <code>--color</code>. |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1146 | </p> |
| 1147 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1148 | <dt class="hdlist1"> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1149 | plain |
| 1150 | </dt> |
| 1151 | <dd> |
| 1152 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1153 | Show words as <code>[-removed-]</code> and <code>{+added+}</code>. Makes no |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1154 | attempts to escape the delimiters if they appear in the input, |
| 1155 | so the output may be ambiguous. |
| 1156 | </p> |
| 1157 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1158 | <dt class="hdlist1"> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1159 | porcelain |
| 1160 | </dt> |
| 1161 | <dd> |
| 1162 | <p> |
| 1163 | Use a special line-based format intended for script |
| 1164 | consumption. Added/removed/unchanged runs are printed in the |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1165 | usual unified diff format, starting with a <code>+</code>/<code>-</code>/` ` |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1166 | character at the beginning of the line and extending to the |
| 1167 | end of the line. Newlines in the input are represented by a |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1168 | tilde <code>~</code> on a line of its own. |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1169 | </p> |
| 1170 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1171 | <dt class="hdlist1"> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1172 | none |
| 1173 | </dt> |
| 1174 | <dd> |
| 1175 | <p> |
| 1176 | Disable word diff again. |
| 1177 | </p> |
| 1178 | </dd> |
| 1179 | </dl></div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 1180 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1181 | <div class="paragraph"><p>Note that despite the name of the first mode, color is used to |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1182 | highlight the changed parts in all modes if enabled.</p></div> |
| 1183 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1184 | <dt class="hdlist1"> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1185 | --word-diff-regex=<regex> |
| 1186 | </dt> |
| 1187 | <dd> |
| 1188 | <p> |
| 1189 | Use <regex> to decide what a word is, instead of considering |
| 1190 | runs of non-whitespace to be a word. Also implies |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1191 | <code>--word-diff</code> unless it was already enabled. |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1192 | </p> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1193 | <div class="paragraph"><p>Every non-overlapping match of the |
Junio C Hamano | 20d47e3 | 2009-01-26 06:36:02 | [diff] [blame] | 1194 | <regex> is considered a word. Anything between these matches is |
| 1195 | considered whitespace and ignored(!) for the purposes of finding |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1196 | differences. You may want to append <code>|[^[:space:]]</code> to your regular |
Junio C Hamano | 20d47e3 | 2009-01-26 06:36:02 | [diff] [blame] | 1197 | expression to make sure that it matches all non-whitespace characters. |
| 1198 | A match that contains a newline is silently truncated(!) at the |
| 1199 | newline.</p></div> |
Junio C Hamano | 713eded | 2015-12-03 00:24:02 | [diff] [blame] | 1200 | <div class="paragraph"><p>For example, <code>--word-diff-regex=.</code> will treat each character as a word |
| 1201 | and, correspondingly, show differences character by character.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1202 | <div class="paragraph"><p>The regex can also be set via a diff driver or configuration option, see |
Junio C Hamano | 198b1f1 | 2016-05-17 22:27:24 | [diff] [blame] | 1203 | <a href="gitattributes.html">gitattributes(5)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly |
Junio C Hamano | 20d47e3 | 2009-01-26 06:36:02 | [diff] [blame] | 1204 | overrides any diff driver or configuration setting. Diff drivers |
| 1205 | override configuration settings.</p></div> |
Junio C Hamano | 85e45fa | 2006-08-13 07:47:41 | [diff] [blame] | 1206 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1207 | <dt class="hdlist1"> |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1208 | --color-words[=<regex>] |
| 1209 | </dt> |
| 1210 | <dd> |
| 1211 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1212 | Equivalent to <code>--word-diff=color</code> plus (if a regex was |
| 1213 | specified) <code>--word-diff-regex=<regex></code>. |
Junio C Hamano | cc7636a | 2010-05-21 14:57:53 | [diff] [blame] | 1214 | </p> |
| 1215 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1216 | <dt class="hdlist1"> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 1217 | --no-renames |
| 1218 | </dt> |
| 1219 | <dd> |
| 1220 | <p> |
| 1221 | Turn off rename detection, even when the configuration |
| 1222 | file gives the default to do so. |
| 1223 | </p> |
| 1224 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1225 | <dt class="hdlist1"> |
Junio C Hamano | a890c4f | 2007-01-28 10:29:21 | [diff] [blame] | 1226 | --check |
| 1227 | </dt> |
| 1228 | <dd> |
| 1229 | <p> |
Junio C Hamano | 84ea1e4 | 2016-04-08 21:53:48 | [diff] [blame] | 1230 | Warn if changes introduce conflict markers or whitespace errors. |
| 1231 | What are considered whitespace errors is controlled by <code>core.whitespace</code> |
Junio C Hamano | 6005bfa | 2011-06-23 00:51:22 | [diff] [blame] | 1232 | configuration. By default, trailing whitespaces (including |
| 1233 | lines that solely consist of whitespaces) and a space character |
| 1234 | that is immediately followed by a tab character inside the |
| 1235 | initial indent of the line are considered whitespace errors. |
| 1236 | Exits with non-zero status if problems are found. Not compatible |
| 1237 | with --exit-code. |
Junio C Hamano | a890c4f | 2007-01-28 10:29:21 | [diff] [blame] | 1238 | </p> |
| 1239 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1240 | <dt class="hdlist1"> |
Junio C Hamano | 8c5d594 | 2015-06-11 19:37:48 | [diff] [blame] | 1241 | --ws-error-highlight=<kind> |
| 1242 | </dt> |
| 1243 | <dd> |
| 1244 | <p> |
| 1245 | Highlight whitespace errors on lines specified by <kind> |
| 1246 | in the color specified by <code>color.diff.whitespace</code>. <kind> |
| 1247 | is a comma separated list of <code>old</code>, <code>new</code>, <code>context</code>. When |
| 1248 | this option is not given, only whitespace errors in <code>new</code> |
| 1249 | lines are highlighted. E.g. <code>--ws-error-highlight=new,old</code> |
| 1250 | highlights whitespace errors on both deleted and added lines. |
| 1251 | <code>all</code> can be used as a short-hand for <code>old,new,context</code>. |
Junio C Hamano | 4a401d5 | 2016-10-26 22:24:37 | [diff] [blame] | 1252 | The <code>diff.wsErrorHighlight</code> configuration variable can be |
| 1253 | used to specify the default behaviour. |
Junio C Hamano | 8c5d594 | 2015-06-11 19:37:48 | [diff] [blame] | 1254 | </p> |
| 1255 | </dd> |
| 1256 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1257 | --full-index |
| 1258 | </dt> |
| 1259 | <dd> |
| 1260 | <p> |
Junio C Hamano | 5cf43ca | 2008-08-20 09:14:14 | [diff] [blame] | 1261 | Instead of the first handful of characters, show the full |
| 1262 | pre- and post-image blob object names on the "index" |
| 1263 | line when generating patch format output. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1264 | </p> |
| 1265 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1266 | <dt class="hdlist1"> |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 1267 | --binary |
| 1268 | </dt> |
| 1269 | <dd> |
| 1270 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1271 | In addition to <code>--full-index</code>, output a binary diff that |
| 1272 | can be applied with <code>git-apply</code>. |
Junio C Hamano | 9ae1a06 | 2006-07-10 08:12:34 | [diff] [blame] | 1273 | </p> |
| 1274 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1275 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1276 | --abbrev[=<n>] |
| 1277 | </dt> |
| 1278 | <dd> |
| 1279 | <p> |
| 1280 | Instead of showing the full 40-byte hexadecimal object |
| 1281 | name in diff-raw format output and diff-tree header |
Junio C Hamano | 6efe302 | 2009-01-13 16:47:56 | [diff] [blame] | 1282 | lines, show only a partial prefix. This is |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1283 | independent of the <code>--full-index</code> option above, which controls |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1284 | the diff-patch output format. Non default number of |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1285 | digits can be specified with <code>--abbrev=<n></code>. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1286 | </p> |
| 1287 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1288 | <dt class="hdlist1"> |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1289 | -B[<n>][/<m>] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1290 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1291 | <dt class="hdlist1"> |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 1292 | --break-rewrites[=[<n>][/<m>]] |
| 1293 | </dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1294 | <dd> |
| 1295 | <p> |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1296 | Break complete rewrite changes into pairs of delete and |
| 1297 | create. This serves two purposes: |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1298 | </p> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1299 | <div class="paragraph"><p>It affects the way a change that amounts to a total rewrite of a file |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1300 | not as a series of deletion and insertion mixed together with a very |
| 1301 | few lines that happen to match textually as the context, but as a |
| 1302 | single deletion of everything old followed by a single insertion of |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1303 | everything new, and the number <code>m</code> controls this aspect of the -B |
| 1304 | option (defaults to 60%). <code>-B/70%</code> specifies that less than 30% of the |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 1305 | original should remain in the result for Git to consider it a total |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1306 | rewrite (i.e. otherwise the resulting patch will be a series of |
| 1307 | deletion and insertion mixed together with context lines).</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1308 | <div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1309 | source of a rename (usually -M only considers a file that disappeared |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1310 | as the source of a rename), and the number <code>n</code> controls this aspect of |
| 1311 | the -B option (defaults to 50%). <code>-B20%</code> specifies that a change with |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1312 | addition and deletion compared to 20% or more of the file’s size are |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1313 | eligible for being picked up as a possible source of a rename to |
| 1314 | another file.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1315 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1316 | <dt class="hdlist1"> |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1317 | -M[<n>] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1318 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1319 | <dt class="hdlist1"> |
Junio C Hamano | 0d75e87 | 2010-12-17 06:57:26 | [diff] [blame] | 1320 | --find-renames[=<n>] |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 1321 | </dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1322 | <dd> |
| 1323 | <p> |
| 1324 | Detect renames. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1325 | If <code>n</code> is specified, it is a threshold on the similarity |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1326 | index (i.e. amount of addition/deletions compared to the |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1327 | file’s size). For example, <code>-M90%</code> means Git should consider a |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1328 | delete/add pair to be a rename if more than 90% of the file |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1329 | hasn’t changed. Without a <code>%</code> sign, the number is to be read as |
| 1330 | a fraction, with a decimal point before it. I.e., <code>-M5</code> becomes |
| 1331 | 0.5, and is thus the same as <code>-M50%</code>. Similarly, <code>-M05</code> is |
| 1332 | the same as <code>-M5%</code>. To limit detection to exact renames, use |
| 1333 | <code>-M100%</code>. The default similarity index is 50%. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1334 | </p> |
| 1335 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1336 | <dt class="hdlist1"> |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 1337 | -C[<n>] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1338 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1339 | <dt class="hdlist1"> |
Junio C Hamano | 0d75e87 | 2010-12-17 06:57:26 | [diff] [blame] | 1340 | --find-copies[=<n>] |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 1341 | </dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1342 | <dd> |
| 1343 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1344 | Detect copies as well as renames. See also <code>--find-copies-harder</code>. |
| 1345 | If <code>n</code> is specified, it has the same meaning as for <code>-M<n></code>. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1346 | </p> |
| 1347 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1348 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1349 | --find-copies-harder |
| 1350 | </dt> |
| 1351 | <dd> |
| 1352 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1353 | For performance reasons, by default, <code>-C</code> option finds copies only |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1354 | if the original file of the copy was modified in the same |
| 1355 | changeset. This flag makes the command |
| 1356 | inspect unmodified files as candidates for the source of |
| 1357 | copy. This is a very expensive operation for large |
Junio C Hamano | 16f9887 | 2007-06-12 16:09:14 | [diff] [blame] | 1358 | projects, so use it with caution. Giving more than one |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1359 | <code>-C</code> option has the same effect. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1360 | </p> |
| 1361 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1362 | <dt class="hdlist1"> |
Junio C Hamano | b02377c | 2011-04-28 22:26:02 | [diff] [blame] | 1363 | -D |
| 1364 | </dt> |
| 1365 | <dt class="hdlist1"> |
| 1366 | --irreversible-delete |
| 1367 | </dt> |
| 1368 | <dd> |
| 1369 | <p> |
| 1370 | Omit the preimage for deletes, i.e. print only the header but not |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1371 | the diff between the preimage and <code>/dev/null</code>. The resulting patch |
| 1372 | is not meant to be applied with <code>patch</code> or <code>git apply</code>; this is |
Junio C Hamano | b02377c | 2011-04-28 22:26:02 | [diff] [blame] | 1373 | solely for people who want to just concentrate on reviewing the |
| 1374 | text after the change. In addition, the output obviously lack |
| 1375 | enough information to apply such a patch in reverse, even manually, |
| 1376 | hence the name of the option. |
| 1377 | </p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1378 | <div class="paragraph"><p>When used together with <code>-B</code>, omit also the preimage in the deletion part |
Junio C Hamano | b02377c | 2011-04-28 22:26:02 | [diff] [blame] | 1379 | of a delete/create pair.</p></div> |
| 1380 | </dd> |
| 1381 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1382 | -l<num> |
| 1383 | </dt> |
| 1384 | <dd> |
| 1385 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1386 | The <code>-M</code> and <code>-C</code> options require O(n^2) processing time where n |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1387 | is the number of potential rename/copy targets. This |
| 1388 | option prevents rename/copy detection from running if |
| 1389 | the number of rename/copy targets exceeds the specified |
| 1390 | number. |
| 1391 | </p> |
| 1392 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1393 | <dt class="hdlist1"> |
Junio C Hamano | 982eb11 | 2010-11-18 00:53:09 | [diff] [blame] | 1394 | --diff-filter=[(A|C|D|M|R|T|U|X|B)…[*]] |
| 1395 | </dt> |
| 1396 | <dd> |
| 1397 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1398 | Select only files that are Added (<code>A</code>), Copied (<code>C</code>), |
| 1399 | Deleted (<code>D</code>), Modified (<code>M</code>), Renamed (<code>R</code>), have their |
| 1400 | type (i.e. regular file, symlink, submodule, …) changed (<code>T</code>), |
| 1401 | are Unmerged (<code>U</code>), are |
| 1402 | Unknown (<code>X</code>), or have had their pairing Broken (<code>B</code>). |
Junio C Hamano | 982eb11 | 2010-11-18 00:53:09 | [diff] [blame] | 1403 | Any combination of the filter characters (including none) can be used. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1404 | When <code>*</code> (All-or-none) is added to the combination, all |
Junio C Hamano | 982eb11 | 2010-11-18 00:53:09 | [diff] [blame] | 1405 | paths are selected if there is any file that matches |
| 1406 | other criteria in the comparison; if there is no file |
| 1407 | that matches other criteria, nothing is selected. |
| 1408 | </p> |
Junio C Hamano | eed15af | 2016-07-25 22:49:42 | [diff] [blame] | 1409 | <div class="paragraph"><p>Also, these upper-case letters can be downcased to exclude. E.g. |
| 1410 | <code>--diff-filter=ad</code> excludes added and deleted paths.</p></div> |
Junio C Hamano | 982eb11 | 2010-11-18 00:53:09 | [diff] [blame] | 1411 | </dd> |
| 1412 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1413 | -S<string> |
| 1414 | </dt> |
| 1415 | <dd> |
| 1416 | <p> |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1417 | Look for differences that change the number of occurrences of |
| 1418 | the specified string (i.e. addition/deletion) in a file. |
| 1419 | Intended for the scripter’s use. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1420 | </p> |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1421 | <div class="paragraph"><p>It is useful when you’re looking for an exact block of code (like a |
| 1422 | struct), and want to know the history of that block since it first |
| 1423 | came into being: use the feature iteratively to feed the interesting |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1424 | block in the preimage back into <code>-S</code>, and keep going until you get the |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1425 | very first version of the block.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1426 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1427 | <dt class="hdlist1"> |
Junio C Hamano | 3b4609d | 2010-09-30 00:04:34 | [diff] [blame] | 1428 | -G<regex> |
| 1429 | </dt> |
| 1430 | <dd> |
| 1431 | <p> |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1432 | Look for differences whose patch text contains added/removed |
| 1433 | lines that match <regex>. |
Junio C Hamano | 3b4609d | 2010-09-30 00:04:34 | [diff] [blame] | 1434 | </p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1435 | <div class="paragraph"><p>To illustrate the difference between <code>-S<regex> --pickaxe-regex</code> and |
| 1436 | <code>-G<regex></code>, consider a commit with the following diff in the same |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1437 | file:</p></div> |
| 1438 | <div class="listingblock"> |
| 1439 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1440 | <pre><code>+ return !regexec(regexp, two->ptr, 1, &regmatch, 0); |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1441 | ... |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1442 | - hit = !regexec(regexp, mf2.ptr, 1, &regmatch, 0);</code></pre> |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1443 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1444 | <div class="paragraph"><p>While <code>git log -G"regexec\(regexp"</code> will show this commit, <code>git log |
| 1445 | -S"regexec\(regexp" --pickaxe-regex</code> will not (because the number of |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1446 | occurrences of that string did not change).</p></div> |
| 1447 | <div class="paragraph"><p>See the <em>pickaxe</em> entry in <a href="gitdiffcore.html">gitdiffcore(7)</a> for more |
| 1448 | information.</p></div> |
Junio C Hamano | 3b4609d | 2010-09-30 00:04:34 | [diff] [blame] | 1449 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1450 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1451 | --pickaxe-all |
| 1452 | </dt> |
| 1453 | <dd> |
| 1454 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1455 | When <code>-S</code> or <code>-G</code> finds a change, show all the changes in that |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1456 | changeset, not just the files that contain the change |
| 1457 | in <string>. |
| 1458 | </p> |
| 1459 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1460 | <dt class="hdlist1"> |
Junio C Hamano | bfe9e75 | 2006-04-05 21:43:28 | [diff] [blame] | 1461 | --pickaxe-regex |
| 1462 | </dt> |
| 1463 | <dd> |
| 1464 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1465 | Treat the <string> given to <code>-S</code> as an extended POSIX regular |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1466 | expression to match. |
Junio C Hamano | bfe9e75 | 2006-04-05 21:43:28 | [diff] [blame] | 1467 | </p> |
| 1468 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1469 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1470 | -O<orderfile> |
| 1471 | </dt> |
| 1472 | <dd> |
| 1473 | <p> |
| 1474 | Output the patch in the order specified in the |
| 1475 | <orderfile>, which has one shell glob pattern per line. |
Junio C Hamano | 322c624 | 2015-03-23 21:32:46 | [diff] [blame] | 1476 | This overrides the <code>diff.orderFile</code> configuration variable |
| 1477 | (see <a href="git-config.html">git-config(1)</a>). To cancel <code>diff.orderFile</code>, |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1478 | use <code>-O/dev/null</code>. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1479 | </p> |
| 1480 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1481 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1482 | -R |
| 1483 | </dt> |
| 1484 | <dd> |
| 1485 | <p> |
| 1486 | Swap two inputs; that is, show differences from index or |
| 1487 | on-disk file to tree contents. |
| 1488 | </p> |
| 1489 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1490 | <dt class="hdlist1"> |
Junio C Hamano | 24bc09a | 2008-02-28 00:27:44 | [diff] [blame] | 1491 | --relative[=<path>] |
| 1492 | </dt> |
| 1493 | <dd> |
| 1494 | <p> |
| 1495 | When run from a subdirectory of the project, it can be |
| 1496 | told to exclude changes outside the directory and show |
| 1497 | pathnames relative to it with this option. When you are |
| 1498 | not in a subdirectory (e.g. in a bare repository), you |
| 1499 | can name which subdirectory to make the output relative |
| 1500 | to by giving a <path> as an argument. |
| 1501 | </p> |
| 1502 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1503 | <dt class="hdlist1"> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 1504 | -a |
| 1505 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1506 | <dt class="hdlist1"> |
Junio C Hamano | c26f548 | 2006-07-09 09:38:14 | [diff] [blame] | 1507 | --text |
| 1508 | </dt> |
| 1509 | <dd> |
| 1510 | <p> |
| 1511 | Treat all files as text. |
| 1512 | </p> |
| 1513 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1514 | <dt class="hdlist1"> |
Junio C Hamano | fd46896 | 2007-02-14 23:45:04 | [diff] [blame] | 1515 | --ignore-space-at-eol |
| 1516 | </dt> |
| 1517 | <dd> |
| 1518 | <p> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 1519 | Ignore changes in whitespace at EOL. |
Junio C Hamano | fd46896 | 2007-02-14 23:45:04 | [diff] [blame] | 1520 | </p> |
| 1521 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1522 | <dt class="hdlist1"> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 1523 | -b |
| 1524 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1525 | <dt class="hdlist1"> |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 1526 | --ignore-space-change |
| 1527 | </dt> |
| 1528 | <dd> |
| 1529 | <p> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 1530 | Ignore changes in amount of whitespace. This ignores whitespace |
| 1531 | at line end, and considers all other sequences of one or |
| 1532 | more whitespace characters to be equivalent. |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 1533 | </p> |
| 1534 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1535 | <dt class="hdlist1"> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 1536 | -w |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 1537 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1538 | <dt class="hdlist1"> |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 1539 | --ignore-all-space |
| 1540 | </dt> |
| 1541 | <dd> |
| 1542 | <p> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 1543 | Ignore whitespace when comparing lines. This ignores |
| 1544 | differences even if one line has whitespace where the other |
Junio C Hamano | d9c2d2f | 2006-12-06 08:59:07 | [diff] [blame] | 1545 | line has none. |
| 1546 | </p> |
| 1547 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1548 | <dt class="hdlist1"> |
Junio C Hamano | a195230 | 2013-07-01 21:31:18 | [diff] [blame] | 1549 | --ignore-blank-lines |
| 1550 | </dt> |
| 1551 | <dd> |
| 1552 | <p> |
| 1553 | Ignore changes whose lines are all blank. |
| 1554 | </p> |
| 1555 | </dd> |
| 1556 | <dt class="hdlist1"> |
Junio C Hamano | 1d40ee8 | 2009-01-07 10:14:16 | [diff] [blame] | 1557 | --inter-hunk-context=<lines> |
| 1558 | </dt> |
| 1559 | <dd> |
| 1560 | <p> |
| 1561 | Show the context between diff hunks, up to the specified number |
| 1562 | of lines, thereby fusing hunks that are close to each other. |
| 1563 | </p> |
| 1564 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1565 | <dt class="hdlist1"> |
Junio C Hamano | 11821ed | 2011-10-19 18:42:09 | [diff] [blame] | 1566 | -W |
| 1567 | </dt> |
| 1568 | <dt class="hdlist1"> |
| 1569 | --function-context |
| 1570 | </dt> |
| 1571 | <dd> |
| 1572 | <p> |
| 1573 | Show whole surrounding functions of changes. |
| 1574 | </p> |
| 1575 | </dd> |
| 1576 | <dt class="hdlist1"> |
Junio C Hamano | 48fd2f6 | 2007-03-19 02:02:30 | [diff] [blame] | 1577 | --exit-code |
| 1578 | </dt> |
| 1579 | <dd> |
| 1580 | <p> |
| 1581 | Make the program exit with codes similar to diff(1). |
| 1582 | That is, it exits with 1 if there were differences and |
| 1583 | 0 means no differences. |
| 1584 | </p> |
| 1585 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1586 | <dt class="hdlist1"> |
Junio C Hamano | 35e5755 | 2007-03-25 07:54:35 | [diff] [blame] | 1587 | --quiet |
| 1588 | </dt> |
| 1589 | <dd> |
| 1590 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1591 | Disable all output of the program. Implies <code>--exit-code</code>. |
Junio C Hamano | 35e5755 | 2007-03-25 07:54:35 | [diff] [blame] | 1592 | </p> |
| 1593 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1594 | <dt class="hdlist1"> |
Junio C Hamano | bb0f404 | 2007-07-04 06:41:40 | [diff] [blame] | 1595 | --ext-diff |
| 1596 | </dt> |
| 1597 | <dd> |
| 1598 | <p> |
| 1599 | Allow an external diff helper to be executed. If you set an |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1600 | external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need |
| 1601 | 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] | 1602 | </p> |
| 1603 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1604 | <dt class="hdlist1"> |
Junio C Hamano | bb0f404 | 2007-07-04 06:41:40 | [diff] [blame] | 1605 | --no-ext-diff |
| 1606 | </dt> |
| 1607 | <dd> |
| 1608 | <p> |
| 1609 | Disallow external diff drivers. |
| 1610 | </p> |
| 1611 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1612 | <dt class="hdlist1"> |
Junio C Hamano | c652aed | 2011-07-07 01:14:31 | [diff] [blame] | 1613 | --textconv |
| 1614 | </dt> |
| 1615 | <dt class="hdlist1"> |
| 1616 | --no-textconv |
| 1617 | </dt> |
| 1618 | <dd> |
| 1619 | <p> |
| 1620 | Allow (or disallow) external text conversion filters to be run |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1621 | when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for |
Junio C Hamano | c652aed | 2011-07-07 01:14:31 | [diff] [blame] | 1622 | details. Because textconv filters are typically a one-way |
| 1623 | conversion, the resulting diff is suitable for human |
| 1624 | consumption, but cannot be applied. For this reason, textconv |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1625 | filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and |
| 1626 | <a href="git-log.html">git-log(1)</a>, but not for <a href="git-format-patch.html">git-format-patch(1)</a> or |
Junio C Hamano | c652aed | 2011-07-07 01:14:31 | [diff] [blame] | 1627 | diff plumbing commands. |
| 1628 | </p> |
| 1629 | </dd> |
| 1630 | <dt class="hdlist1"> |
Junio C Hamano | 7d44952 | 2010-07-01 00:08:51 | [diff] [blame] | 1631 | --ignore-submodules[=<when>] |
Junio C Hamano | dfccbb0 | 2008-05-26 01:16:14 | [diff] [blame] | 1632 | </dt> |
| 1633 | <dd> |
| 1634 | <p> |
Junio C Hamano | 7d44952 | 2010-07-01 00:08:51 | [diff] [blame] | 1635 | Ignore changes to submodules in the diff generation. <when> can be |
Junio C Hamano | c710296 | 2013-05-29 23:57:17 | [diff] [blame] | 1636 | either "none", "untracked", "dirty" or "all", which is the default. |
Junio C Hamano | 619596a | 2010-08-18 22:15:35 | [diff] [blame] | 1637 | Using "none" will consider the submodule modified when it either contains |
| 1638 | untracked or modified files or its HEAD differs from the commit recorded |
| 1639 | in the superproject and can be used to override any settings of the |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1640 | <em>ignore</em> option in <a href="git-config.html">git-config(1)</a> or <a href="gitmodules.html">gitmodules(5)</a>. When |
Junio C Hamano | 7d44952 | 2010-07-01 00:08:51 | [diff] [blame] | 1641 | "untracked" is used submodules are not considered dirty when they only |
| 1642 | contain untracked content (but they are still scanned for modified |
| 1643 | content). Using "dirty" ignores all changes to the work tree of submodules, |
| 1644 | only changes to the commits stored in the superproject are shown (this was |
| 1645 | the behavior until 1.7.0). Using "all" hides all changes to submodules. |
Junio C Hamano | dfccbb0 | 2008-05-26 01:16:14 | [diff] [blame] | 1646 | </p> |
| 1647 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1648 | <dt class="hdlist1"> |
Junio C Hamano | e27cbd2 | 2007-12-21 17:57:33 | [diff] [blame] | 1649 | --src-prefix=<prefix> |
| 1650 | </dt> |
| 1651 | <dd> |
| 1652 | <p> |
| 1653 | Show the given source prefix instead of "a/". |
| 1654 | </p> |
| 1655 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1656 | <dt class="hdlist1"> |
Junio C Hamano | e27cbd2 | 2007-12-21 17:57:33 | [diff] [blame] | 1657 | --dst-prefix=<prefix> |
| 1658 | </dt> |
| 1659 | <dd> |
| 1660 | <p> |
| 1661 | Show the given destination prefix instead of "b/". |
| 1662 | </p> |
| 1663 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1664 | <dt class="hdlist1"> |
Junio C Hamano | e27cbd2 | 2007-12-21 17:57:33 | [diff] [blame] | 1665 | --no-prefix |
| 1666 | </dt> |
| 1667 | <dd> |
| 1668 | <p> |
| 1669 | Do not show any source or destination prefix. |
| 1670 | </p> |
| 1671 | </dd> |
Junio C Hamano | cd45166 | 2016-09-13 00:54:09 | [diff] [blame] | 1672 | <dt class="hdlist1"> |
| 1673 | --line-prefix=<prefix> |
| 1674 | </dt> |
| 1675 | <dd> |
| 1676 | <p> |
| 1677 | Prepend an additional prefix to every line of output. |
| 1678 | </p> |
| 1679 | </dd> |
Junio C Hamano | f7017f1 | 2016-10-27 23:31:34 | [diff] [blame^] | 1680 | <dt class="hdlist1"> |
| 1681 | --ita-invisible-in-index |
| 1682 | </dt> |
| 1683 | <dd> |
| 1684 | <p> |
| 1685 | By default entries added by "git add -N" appear as an existing |
| 1686 | empty file in "git diff" and a new file in "git diff --cached". |
| 1687 | This option makes the entry appear as a new file in "git diff" |
| 1688 | and non-existent in "git diff --cached". This option could be |
| 1689 | reverted with <code>--ita-visible-in-index</code>. Both options are |
| 1690 | experimental and could be removed in future. |
| 1691 | </p> |
| 1692 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1693 | </dl></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1694 | <div class="paragraph"><p>For more detailed explanation on these common options, see also |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1695 | <a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1696 | <div class="dlist"><dl> |
| 1697 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1698 | <tree-ish> |
| 1699 | </dt> |
| 1700 | <dd> |
| 1701 | <p> |
| 1702 | The id of a tree object to diff against. |
| 1703 | </p> |
| 1704 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1705 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1706 | --cached |
| 1707 | </dt> |
| 1708 | <dd> |
| 1709 | <p> |
| 1710 | do not consider the on-disk file at all |
| 1711 | </p> |
| 1712 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1713 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1714 | -m |
| 1715 | </dt> |
| 1716 | <dd> |
| 1717 | <p> |
| 1718 | By default, files recorded in the index but not checked |
| 1719 | out are reported as deleted. This flag makes |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1720 | <em>git diff-index</em> say that all non-checked-out files are up |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1721 | to date. |
| 1722 | </p> |
| 1723 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1724 | </dl></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1725 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 1726 | </div> |
| 1727 | <div class="sect1"> |
Junio C Hamano | 543f8d6 | 2009-07-29 08:35:21 | [diff] [blame] | 1728 | <h2 id="_raw_output_format">Raw output format</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1729 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1730 | <div class="paragraph"><p>The raw output format from "git-diff-index", "git-diff-tree", |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1731 | "git-diff-files" and "git diff --raw" are very similar.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1732 | <div class="paragraph"><p>These commands all compare two sets of things; what is |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1733 | compared differs:</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1734 | <div class="dlist"><dl> |
| 1735 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1736 | git-diff-index <tree-ish> |
| 1737 | </dt> |
| 1738 | <dd> |
| 1739 | <p> |
| 1740 | compares the <tree-ish> and the files on the filesystem. |
| 1741 | </p> |
| 1742 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1743 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1744 | git-diff-index --cached <tree-ish> |
| 1745 | </dt> |
| 1746 | <dd> |
| 1747 | <p> |
| 1748 | compares the <tree-ish> and the index. |
| 1749 | </p> |
| 1750 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1751 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1752 | git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>…] |
| 1753 | </dt> |
| 1754 | <dd> |
| 1755 | <p> |
| 1756 | compares the trees named by the two arguments. |
| 1757 | </p> |
| 1758 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1759 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1760 | git-diff-files [<pattern>…] |
| 1761 | </dt> |
| 1762 | <dd> |
| 1763 | <p> |
| 1764 | compares the index and the files on the filesystem. |
| 1765 | </p> |
| 1766 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1767 | </dl></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1768 | <div class="paragraph"><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] | 1769 | what is being compared. After that, all the commands print one output |
| 1770 | line per changed file.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1771 | <div class="paragraph"><p>An output line is formatted this way:</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1772 | <div class="listingblock"> |
| 1773 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1774 | <pre><code>in-place edit :100644 100644 bcd1234... 0123456... M file0 |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1775 | copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2 |
| 1776 | rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3 |
| 1777 | create :000000 100644 0000000... 1234567... A file4 |
| 1778 | delete :100644 000000 1234567... 0000000... D file5 |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1779 | unmerged :000000 000000 0000000... 0000000... U file6</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1780 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1781 | <div class="paragraph"><p>That is, from the left to the right:</p></div> |
| 1782 | <div class="olist arabic"><ol class="arabic"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1783 | <li> |
| 1784 | <p> |
| 1785 | a colon. |
| 1786 | </p> |
| 1787 | </li> |
| 1788 | <li> |
| 1789 | <p> |
| 1790 | mode for "src"; 000000 if creation or unmerged. |
| 1791 | </p> |
| 1792 | </li> |
| 1793 | <li> |
| 1794 | <p> |
| 1795 | a space. |
| 1796 | </p> |
| 1797 | </li> |
| 1798 | <li> |
| 1799 | <p> |
| 1800 | mode for "dst"; 000000 if deletion or unmerged. |
| 1801 | </p> |
| 1802 | </li> |
| 1803 | <li> |
| 1804 | <p> |
| 1805 | a space. |
| 1806 | </p> |
| 1807 | </li> |
| 1808 | <li> |
| 1809 | <p> |
| 1810 | sha1 for "src"; 0{40} if creation or unmerged. |
| 1811 | </p> |
| 1812 | </li> |
| 1813 | <li> |
| 1814 | <p> |
| 1815 | a space. |
| 1816 | </p> |
| 1817 | </li> |
| 1818 | <li> |
| 1819 | <p> |
| 1820 | sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree". |
| 1821 | </p> |
| 1822 | </li> |
| 1823 | <li> |
| 1824 | <p> |
| 1825 | a space. |
| 1826 | </p> |
| 1827 | </li> |
| 1828 | <li> |
| 1829 | <p> |
| 1830 | status, followed by optional "score" number. |
| 1831 | </p> |
| 1832 | </li> |
| 1833 | <li> |
| 1834 | <p> |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 1835 | a tab or a NUL when <code>-z</code> option is used. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1836 | </p> |
| 1837 | </li> |
| 1838 | <li> |
| 1839 | <p> |
| 1840 | path for "src" |
| 1841 | </p> |
| 1842 | </li> |
| 1843 | <li> |
| 1844 | <p> |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 1845 | a tab or a NUL when <code>-z</code> option is used; only exists for C or R. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1846 | </p> |
| 1847 | </li> |
| 1848 | <li> |
| 1849 | <p> |
| 1850 | path for "dst"; only exists for C or R. |
| 1851 | </p> |
| 1852 | </li> |
| 1853 | <li> |
| 1854 | <p> |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 1855 | an LF or a NUL when <code>-z</code> option is used, to terminate the record. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1856 | </p> |
| 1857 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1858 | </ol></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1859 | <div class="paragraph"><p>Possible status letters are:</p></div> |
| 1860 | <div class="ulist"><ul> |
Junio C Hamano | aa17c7c | 2008-11-03 04:36:58 | [diff] [blame] | 1861 | <li> |
| 1862 | <p> |
| 1863 | A: addition of a file |
| 1864 | </p> |
| 1865 | </li> |
| 1866 | <li> |
| 1867 | <p> |
| 1868 | C: copy of a file into a new one |
| 1869 | </p> |
| 1870 | </li> |
| 1871 | <li> |
| 1872 | <p> |
| 1873 | D: deletion of a file |
| 1874 | </p> |
| 1875 | </li> |
| 1876 | <li> |
| 1877 | <p> |
| 1878 | M: modification of the contents or mode of a file |
| 1879 | </p> |
| 1880 | </li> |
| 1881 | <li> |
| 1882 | <p> |
| 1883 | R: renaming of a file |
| 1884 | </p> |
| 1885 | </li> |
| 1886 | <li> |
| 1887 | <p> |
| 1888 | T: change in the type of the file |
| 1889 | </p> |
| 1890 | </li> |
| 1891 | <li> |
| 1892 | <p> |
| 1893 | U: file is unmerged (you must complete the merge before it can |
| 1894 | be committed) |
| 1895 | </p> |
| 1896 | </li> |
| 1897 | <li> |
| 1898 | <p> |
| 1899 | X: "unknown" change type (most probably a bug, please report it) |
| 1900 | </p> |
| 1901 | </li> |
| 1902 | </ul></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1903 | <div class="paragraph"><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] | 1904 | percentage of similarity between the source and target of the move or |
Junio C Hamano | 6bb32e6 | 2015-02-17 22:11:26 | [diff] [blame] | 1905 | copy). Status letter M may be followed by a score (denoting the |
| 1906 | percentage of dissimilarity) for file rewrites.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1907 | <div class="paragraph"><p><sha1> is shown as all 0’s if a file is new on the filesystem |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1908 | and it is out of sync with the index.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1909 | <div class="paragraph"><p>Example:</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1910 | <div class="listingblock"> |
| 1911 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1912 | <pre><code>:100644 100644 5be4a4...... 000000...... M file.c</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1913 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1914 | <div class="paragraph"><p>When <code>-z</code> option is not used, TAB, LF, and backslash characters |
| 1915 | in pathnames are represented as <code>\t</code>, <code>\n</code>, and <code>\\</code>, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1916 | respectively.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1917 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 1918 | </div> |
| 1919 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1920 | <h2 id="_diff_format_for_merges">diff format for merges</h2> |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 1921 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1922 | <div class="paragraph"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw" |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 1923 | can take <code>-c</code> or <code>--cc</code> option |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 1924 | to generate diff output also for merge commits. The output differs |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1925 | from the format described above in the following way:</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1926 | <div class="olist arabic"><ol class="arabic"> |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 1927 | <li> |
| 1928 | <p> |
| 1929 | there is a colon for each parent |
| 1930 | </p> |
| 1931 | </li> |
| 1932 | <li> |
| 1933 | <p> |
| 1934 | there are more "src" modes and "src" sha1 |
| 1935 | </p> |
| 1936 | </li> |
| 1937 | <li> |
| 1938 | <p> |
| 1939 | status is concatenated status characters for each parent |
| 1940 | </p> |
| 1941 | </li> |
| 1942 | <li> |
| 1943 | <p> |
| 1944 | no optional "score" number |
| 1945 | </p> |
| 1946 | </li> |
| 1947 | <li> |
| 1948 | <p> |
| 1949 | single path, only for "dst" |
| 1950 | </p> |
| 1951 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1952 | </ol></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1953 | <div class="paragraph"><p>Example:</p></div> |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 1954 | <div class="listingblock"> |
| 1955 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1956 | <pre><code>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</code></pre> |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 1957 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1958 | <div class="paragraph"><p>Note that <em>combined diff</em> lists only files which were modified from |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1959 | all parents.</p></div> |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 1960 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 1961 | </div> |
| 1962 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1963 | <h2 id="_generating_patches_with_p">Generating patches with -p</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1964 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1965 | <div class="paragraph"><p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 1966 | with a <code>-p</code> option, "git diff" without the <code>--raw</code> option, or |
Junio C Hamano | 00b8b63 | 2007-12-07 09:50:49 | [diff] [blame] | 1967 | "git log" with the "-p" option, they |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 1968 | do not produce the output described above; instead they produce a |
| 1969 | patch file. You can customize the creation of such patches via the |
Junio C Hamano | 042f214 | 2016-06-27 18:05:05 | [diff] [blame] | 1970 | <code>GIT_EXTERNAL_DIFF</code> and the <code>GIT_DIFF_OPTS</code> environment variables.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1971 | <div class="paragraph"><p>What the -p option produces is slightly different from the traditional |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 1972 | diff format:</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1973 | <div class="olist arabic"><ol class="arabic"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1974 | <li> |
| 1975 | <p> |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 1976 | It is preceded with a "git diff" header that looks like this: |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1977 | </p> |
| 1978 | <div class="literalblock"> |
| 1979 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1980 | <pre><code>diff --git a/file1 b/file2</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1981 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1982 | <div class="paragraph"><p>The <code>a/</code> and <code>b/</code> filenames are the same unless rename/copy is |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1983 | involved. Especially, even for a creation or a deletion, |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1984 | <code>/dev/null</code> is <em>not</em> used in place of the <code>a/</code> or <code>b/</code> filenames.</p></div> |
| 1985 | <div class="paragraph"><p>When rename/copy is involved, <code>file1</code> and <code>file2</code> show the |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1986 | 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] | 1987 | the file that rename/copy produces, respectively.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1988 | </li> |
| 1989 | <li> |
| 1990 | <p> |
| 1991 | It is followed by one or more extended header lines: |
| 1992 | </p> |
| 1993 | <div class="literalblock"> |
| 1994 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1995 | <pre><code>old mode <mode> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1996 | new mode <mode> |
| 1997 | deleted file mode <mode> |
| 1998 | new file mode <mode> |
| 1999 | copy from <path> |
| 2000 | copy to <path> |
| 2001 | rename from <path> |
| 2002 | rename to <path> |
| 2003 | similarity index <number> |
| 2004 | dissimilarity index <number> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2005 | index <hash>..<hash> <mode></code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2006 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2007 | <div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2008 | and file permission bits.</p></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2009 | <div class="paragraph"><p>Path names in extended headers do not include the <code>a/</code> and <code>b/</code> prefixes.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2010 | <div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2011 | the dissimilarity index is the percentage of changed lines. It |
| 2012 | is a rounded down integer, followed by a percent sign. The |
| 2013 | similarity index value of 100% is thus reserved for two equal |
| 2014 | files, while 100% dissimilarity means that no line from the old |
| 2015 | file made it into the new one.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2016 | <div class="paragraph"><p>The index line includes the SHA-1 checksum before and after the change. |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2017 | The <mode> is included if the file mode does not change; otherwise, |
| 2018 | separate lines indicate the old and the new mode.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2019 | </li> |
| 2020 | <li> |
| 2021 | <p> |
Junio C Hamano | a053d54 | 2006-10-27 09:29:13 | [diff] [blame] | 2022 | TAB, LF, double quote and backslash characters in pathnames |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2023 | are represented as <code>\t</code>, <code>\n</code>, <code>\"</code> and <code>\\</code>, respectively. |
Junio C Hamano | a053d54 | 2006-10-27 09:29:13 | [diff] [blame] | 2024 | If there is need for such substitution then the whole |
| 2025 | pathname is put in double quotes. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2026 | </p> |
| 2027 | </li> |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2028 | <li> |
| 2029 | <p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2030 | All the <code>file1</code> files in the output refer to files before the |
| 2031 | commit, and all the <code>file2</code> files refer to files after the commit. |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2032 | It is incorrect to apply each change to each file sequentially. For |
| 2033 | example, this patch will swap a and b: |
| 2034 | </p> |
| 2035 | <div class="literalblock"> |
| 2036 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2037 | <pre><code>diff --git a/a b/b |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2038 | rename from a |
| 2039 | rename to b |
| 2040 | diff --git a/b b/a |
| 2041 | rename from b |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2042 | rename to a</code></pre> |
Junio C Hamano | 7f9fa86 | 2010-10-19 23:51:14 | [diff] [blame] | 2043 | </div></div> |
| 2044 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2045 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2046 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2047 | </div> |
| 2048 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2049 | <h2 id="_combined_diff_format">combined diff format</h2> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2050 | <div class="sectionbody"> |
Junio C Hamano | 1dbca52 | 2015-05-22 20:48:55 | [diff] [blame] | 2051 | <div class="paragraph"><p>Any diff-generating command can take the <code>-c</code> or <code>--cc</code> option to |
Junio C Hamano | c5be4cc | 2011-03-09 07:20:43 | [diff] [blame] | 2052 | produce a <em>combined diff</em> when showing a merge. This is the default |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 2053 | format when showing merges with <a href="git-diff.html">git-diff(1)</a> or |
Junio C Hamano | 1dbca52 | 2015-05-22 20:48:55 | [diff] [blame] | 2054 | <a href="git-show.html">git-show(1)</a>. Note also that you can give the <code>-m</code> option to any |
Junio C Hamano | c5be4cc | 2011-03-09 07:20:43 | [diff] [blame] | 2055 | of these commands to force generation of diffs with individual parents |
| 2056 | of a merge.</p></div> |
| 2057 | <div class="paragraph"><p>A <em>combined diff</em> format looks like this:</p></div> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2058 | <div class="listingblock"> |
| 2059 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2060 | <pre><code>diff --combined describe.c |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2061 | index fabadb8,cc95eb0..4866510 |
| 2062 | --- a/describe.c |
| 2063 | +++ b/describe.c |
| 2064 | @@@ -98,20 -98,12 +98,20 @@@ |
| 2065 | return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1; |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2066 | } |
| 2067 | |
| 2068 | - static void describe(char *arg) |
| 2069 | -static void describe(struct commit *cmit, int last_one) |
| 2070 | ++static void describe(char *arg, int last_one) |
| 2071 | { |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2072 | + unsigned char sha1[20]; |
| 2073 | + struct commit *cmit; |
| 2074 | struct commit_list *list; |
| 2075 | static int initialized = 0; |
| 2076 | struct commit_name *n; |
| 2077 | |
| 2078 | + if (get_sha1(arg, sha1) < 0) |
| 2079 | + usage(describe_usage); |
| 2080 | + cmit = lookup_commit_reference(sha1); |
| 2081 | + if (!cmit) |
| 2082 | + usage(describe_usage); |
| 2083 | + |
| 2084 | if (!initialized) { |
| 2085 | initialized = 1; |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2086 | for_each_ref(get_name);</code></pre> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2087 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2088 | <div class="olist arabic"><ol class="arabic"> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2089 | <li> |
| 2090 | <p> |
| 2091 | It is preceded with a "git diff" header, that looks like |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 2092 | this (when <code>-c</code> option is used): |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2093 | </p> |
| 2094 | <div class="literalblock"> |
| 2095 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2096 | <pre><code>diff --combined file</code></pre> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2097 | </div></div> |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 2098 | <div class="paragraph"><p>or like this (when <code>--cc</code> option is used):</p></div> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2099 | <div class="literalblock"> |
| 2100 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2101 | <pre><code>diff --cc file</code></pre> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2102 | </div></div> |
| 2103 | </li> |
| 2104 | <li> |
| 2105 | <p> |
| 2106 | It is followed by one or more extended header lines |
| 2107 | (this example shows a merge with two parents): |
| 2108 | </p> |
| 2109 | <div class="literalblock"> |
| 2110 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2111 | <pre><code>index <hash>,<hash>..<hash> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2112 | mode <mode>,<mode>..<mode> |
| 2113 | new file mode <mode> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2114 | deleted file mode <mode>,<mode></code></pre> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2115 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2116 | <div class="paragraph"><p>The <code>mode <mode>,<mode>..<mode></code> line appears only if at least one of |
Junio C Hamano | ee1e428 | 2007-02-04 08:32:04 | [diff] [blame] | 2117 | the <mode> is different from the rest. Extended headers with |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2118 | information about detected contents movement (renames and |
| 2119 | copying detection) are designed to work with diff of two |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2120 | <tree-ish> and are not used by combined diff format.</p></div> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2121 | </li> |
| 2122 | <li> |
| 2123 | <p> |
| 2124 | It is followed by two-line from-file/to-file header |
| 2125 | </p> |
| 2126 | <div class="literalblock"> |
| 2127 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2128 | <pre><code>--- a/file |
| 2129 | +++ b/file</code></pre> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2130 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2131 | <div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2132 | format, <code>/dev/null</code> is used to signal created or deleted |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2133 | files.</p></div> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2134 | </li> |
| 2135 | <li> |
| 2136 | <p> |
| 2137 | Chunk header format is modified to prevent people from |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2138 | accidentally feeding it to <code>patch -p1</code>. Combined diff format |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2139 | was created for review of merge commit changes, and was not |
| 2140 | meant for apply. The change is similar to the change in the |
| 2141 | extended <em>index</em> header: |
| 2142 | </p> |
| 2143 | <div class="literalblock"> |
| 2144 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2145 | <pre><code>@@@ <from-file-range> <from-file-range> <to-file-range> @@@</code></pre> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2146 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2147 | <div class="paragraph"><p>There are (number of parents + 1) <code>@</code> characters in the chunk |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2148 | header for combined diff format.</p></div> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2149 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2150 | </ol></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2151 | <div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2152 | files A and B with a single column that has <code>-</code> (minus — appears in A but removed in B), <code>+</code> (plus — missing in A but |
| 2153 | added to B), or <code>" "</code> (space — unchanged) prefix, this format |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2154 | compares two or more files file1, file2,… with one file X, and |
| 2155 | shows how X differs from each of fileN. One column for each of |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2156 | 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] | 2157 | different from it.</p></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2158 | <div class="paragraph"><p>A <code>-</code> character in the column N means that the line appears in |
| 2159 | fileN but it does not appear in the result. A <code>+</code> character |
Junio C Hamano | 54bf1e2 | 2008-12-20 06:30:11 | [diff] [blame] | 2160 | in the column N means that the line appears in the result, |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 2161 | 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] | 2162 | added, from the point of view of that parent).</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2163 | <div class="paragraph"><p>In the above example output, the function signature was changed |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2164 | from both files (hence two <code>-</code> removals from both file1 and |
| 2165 | file2, plus <code>++</code> to mean one line that was added does not appear |
Junio C Hamano | d75148a | 2014-04-08 19:48:38 | [diff] [blame] | 2166 | in either file1 or file2). Also eight other lines are the same |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2167 | from file1 but do not appear in file2 (hence prefixed with <code>+</code>).</p></div> |
| 2168 | <div class="paragraph"><p>When shown by <code>git diff-tree -c</code>, it compares the parents of a |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2169 | merge commit with the merge result (i.e. file1..fileN are the |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2170 | parents). When shown by <code>git diff-files -c</code>, it compares the |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2171 | two unresolved merge parents with the working tree file |
| 2172 | (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] | 2173 | "their version").</p></div> |
Junio C Hamano | fb56a96 | 2006-01-28 10:38:19 | [diff] [blame] | 2174 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2175 | </div> |
| 2176 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2177 | <h2 id="_other_diff_formats">other diff formats</h2> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2178 | <div class="sectionbody"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2179 | <div class="paragraph"><p>The <code>--summary</code> option describes newly added, deleted, renamed and |
| 2180 | copied files. The <code>--stat</code> option adds diffstat(1) graph to the |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2181 | output. These options can be combined with other options, such as |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2182 | <code>-p</code>, and are meant for human consumption.</p></div> |
| 2183 | <div class="paragraph"><p>When showing a change that involves a rename or a copy, <code>--stat</code> output |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2184 | formats the pathnames compactly by combining common prefix and suffix of |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2185 | the pathnames. For example, a change that moves <code>arch/i386/Makefile</code> to |
| 2186 | <code>arch/x86/Makefile</code> while modifying 4 lines will be shown like this:</p></div> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2187 | <div class="listingblock"> |
| 2188 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2189 | <pre><code>arch/{i386 => x86}/Makefile | 4 +--</code></pre> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2190 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2191 | <div class="paragraph"><p>The <code>--numstat</code> option gives the diffstat(1) information but is designed |
| 2192 | for easier machine consumption. An entry in <code>--numstat</code> output looks |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2193 | like this:</p></div> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2194 | <div class="listingblock"> |
| 2195 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2196 | <pre><code>1 2 README |
| 2197 | 3 1 arch/{i386 => x86}/Makefile</code></pre> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2198 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2199 | <div class="paragraph"><p>That is, from left to right:</p></div> |
| 2200 | <div class="olist arabic"><ol class="arabic"> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2201 | <li> |
| 2202 | <p> |
| 2203 | the number of added lines; |
| 2204 | </p> |
| 2205 | </li> |
| 2206 | <li> |
| 2207 | <p> |
| 2208 | a tab; |
| 2209 | </p> |
| 2210 | </li> |
| 2211 | <li> |
| 2212 | <p> |
| 2213 | the number of deleted lines; |
| 2214 | </p> |
| 2215 | </li> |
| 2216 | <li> |
| 2217 | <p> |
| 2218 | a tab; |
| 2219 | </p> |
| 2220 | </li> |
| 2221 | <li> |
| 2222 | <p> |
| 2223 | pathname (possibly with rename/copy information); |
| 2224 | </p> |
| 2225 | </li> |
| 2226 | <li> |
| 2227 | <p> |
| 2228 | a newline. |
| 2229 | </p> |
| 2230 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2231 | </ol></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2232 | <div class="paragraph"><p>When <code>-z</code> 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] | 2233 | <div class="listingblock"> |
| 2234 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2235 | <pre><code>1 2 README NUL |
| 2236 | 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</code></pre> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2237 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2238 | <div class="paragraph"><p>That is:</p></div> |
| 2239 | <div class="olist arabic"><ol class="arabic"> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2240 | <li> |
| 2241 | <p> |
| 2242 | the number of added lines; |
| 2243 | </p> |
| 2244 | </li> |
| 2245 | <li> |
| 2246 | <p> |
| 2247 | a tab; |
| 2248 | </p> |
| 2249 | </li> |
| 2250 | <li> |
| 2251 | <p> |
| 2252 | the number of deleted lines; |
| 2253 | </p> |
| 2254 | </li> |
| 2255 | <li> |
| 2256 | <p> |
| 2257 | a tab; |
| 2258 | </p> |
| 2259 | </li> |
| 2260 | <li> |
| 2261 | <p> |
| 2262 | a NUL (only exists if renamed/copied); |
| 2263 | </p> |
| 2264 | </li> |
| 2265 | <li> |
| 2266 | <p> |
| 2267 | pathname in preimage; |
| 2268 | </p> |
| 2269 | </li> |
| 2270 | <li> |
| 2271 | <p> |
| 2272 | a NUL (only exists if renamed/copied); |
| 2273 | </p> |
| 2274 | </li> |
| 2275 | <li> |
| 2276 | <p> |
| 2277 | pathname in postimage (only exists if renamed/copied); |
| 2278 | </p> |
| 2279 | </li> |
| 2280 | <li> |
| 2281 | <p> |
| 2282 | a NUL. |
| 2283 | </p> |
| 2284 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2285 | </ol></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2286 | <div class="paragraph"><p>The extra <code>NUL</code> before the preimage path in renamed case is to allow |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2287 | scripts that read the output to tell if the current record being read is |
| 2288 | a single-path record or a rename/copy record without reading ahead. |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2289 | After reading added and deleted lines, reading up to <code>NUL</code> would yield |
| 2290 | the pathname, but if that is <code>NUL</code>, the record will show two paths.</p></div> |
Junio C Hamano | 3a70234 | 2007-12-12 21:34:02 | [diff] [blame] | 2291 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2292 | </div> |
| 2293 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2294 | <h2 id="_operating_modes">Operating Modes</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2295 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2296 | <div class="paragraph"><p>You can choose whether you want to trust the index file entirely |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 2297 | (using the <code>--cached</code> flag) or ask the diff logic to show any files |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2298 | that don’t match the stat state as being "tentatively changed". Both |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2299 | of these operations are very useful indeed.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2300 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2301 | </div> |
| 2302 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2303 | <h2 id="_cached_mode">Cached Mode</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2304 | <div class="sectionbody"> |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 2305 | <div class="paragraph"><p>If <code>--cached</code> is specified, it allows you to ask:</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2306 | <div class="literalblock"> |
| 2307 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2308 | <pre><code>show me the differences between HEAD and the current index |
| 2309 | contents (the ones I'd write using 'git write-tree')</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2310 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2311 | <div class="paragraph"><p>For example, let’s say that you have worked on your working directory, updated |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 2312 | some files in the index and are ready to commit. You want to see exactly |
Junio C Hamano | dcc22ee | 2006-11-03 02:40:13 | [diff] [blame] | 2313 | <strong>what</strong> you are going to commit, without having to write a new tree |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2314 | object and compare it that way, and to do that, you just do</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2315 | <div class="literalblock"> |
| 2316 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2317 | <pre><code>git diff-index --cached HEAD</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2318 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2319 | <div class="paragraph"><p>Example: let’s say I had renamed <code>commit.c</code> to <code>git-commit.c</code>, and I had |
| 2320 | done an <code>update-index</code> to make that effective in the index file. |
| 2321 | <code>git diff-files</code> wouldn’t show anything at all, since the index file |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 2322 | matches my working directory. But doing a <em>git diff-index</em> does:</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2323 | <div class="literalblock"> |
| 2324 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2325 | <pre><code>torvalds@ppc970:~/git> git diff-index --cached HEAD |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2326 | -100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 commit.c |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2327 | +100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 git-commit.c</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2328 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2329 | <div class="paragraph"><p>You can see easily that the above is a rename.</p></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2330 | <div class="paragraph"><p>In fact, <code>git diff-index --cached</code> <strong>should</strong> always be entirely equivalent to |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 2331 | actually doing a <em>git write-tree</em> and comparing that. Except this one is much |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2332 | nicer for the case where you just want to check where you are.</p></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2333 | <div class="paragraph"><p>So doing a <code>git diff-index --cached</code> is basically very useful when you are |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2334 | asking yourself "what have I already marked for being committed, and |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2335 | what’s the difference to a previous tree".</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2336 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2337 | </div> |
| 2338 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2339 | <h2 id="_non_cached_mode">Non-cached Mode</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2340 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2341 | <div class="paragraph"><p>The "non-cached" mode takes a different approach, and is potentially |
| 2342 | the more useful of the two in that what it does can’t be emulated with |
| 2343 | a <em>git write-tree</em> + <em>git diff-tree</em>. Thus that’s the default mode. |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2344 | The non-cached version asks the question:</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2345 | <div class="literalblock"> |
| 2346 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2347 | <pre><code>show me the differences between HEAD and the currently checked out |
| 2348 | tree - index contents _and_ files that aren't up-to-date</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2349 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2350 | <div class="paragraph"><p>which is obviously a very useful question too, since that tells you what |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 2351 | you <strong>could</strong> commit. Again, the output matches the <em>git diff-tree -r</em> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2352 | output to a tee, but with a twist.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2353 | <div class="paragraph"><p>The twist is that if some file doesn’t match the index, we don’t have |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2354 | a backing store thing for it, and we use the magic "all-zero" sha1 to |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2355 | show that. So let’s say that you have edited <code>kernel/sched.c</code>, but |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 2356 | have not actually done a <em>git update-index</em> on it yet - there is no |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2357 | "object" associated with the new state, and you get:</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2358 | <div class="literalblock"> |
| 2359 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2360 | <pre><code>torvalds@ppc970:~/v2.6/linux> git diff-index --abbrev HEAD |
| 2361 | :100644 100664 7476bb... 000000... kernel/sched.c</code></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2362 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2363 | <div class="paragraph"><p>i.e., it shows that the tree has changed, and that <code>kernel/sched.c</code> has is |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2364 | not up-to-date and may contain new stuff. The all-zero sha1 means that to |
| 2365 | get the real diff, you need to look at the object in the working directory |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2366 | directly rather than do an object-to-object diff.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2367 | <div class="admonitionblock"> |
| 2368 | <table><tr> |
| 2369 | <td class="icon"> |
| 2370 | <div class="title">Note</div> |
| 2371 | </td> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 2372 | <td class="content">As with other commands of this type, <em>git diff-index</em> does not |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2373 | actually look at the contents of the file at all. So maybe |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 2374 | <code>kernel/sched.c</code> hasn’t actually changed, and it’s just that you |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 2375 | touched it. In either case, it’s a note that you need to |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 2376 | <em>git update-index</em> it to make the index be in sync.</td> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2377 | </tr></table> |
| 2378 | </div> |
| 2379 | <div class="admonitionblock"> |
| 2380 | <table><tr> |
| 2381 | <td class="icon"> |
| 2382 | <div class="title">Note</div> |
| 2383 | </td> |
| 2384 | <td class="content">You can have a mixture of files show up as "has been updated" |
| 2385 | and "is still dirty in the working directory" together. You can always |
| 2386 | tell which file is in which state, since the "has been updated" ones |
| 2387 | show a valid sha1, and the "not in sync with the index" ones will |
| 2388 | always have the special all-zero sha1.</td> |
| 2389 | </tr></table> |
| 2390 | </div> |
| 2391 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2392 | </div> |
| 2393 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 2394 | <h2 id="_git">GIT</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2395 | <div class="sectionbody"> |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 2396 | <div class="paragraph"><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] | 2397 | </div> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 2398 | </div> |
Junio C Hamano | 9629d4f | 2012-12-19 00:28:27 | [diff] [blame] | 2399 | </div> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 2400 | <div id="footnotes"><hr /></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2401 | <div id="footer"> |
| 2402 | <div id="footer-text"> |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 2403 | Last updated 2016-07-13 14:58:50 PDT |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2404 | </div> |
| 2405 | </div> |
| 2406 | </body> |
| 2407 | </html> |