Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
| 2 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 7.0.2" /> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | <style type="text/css"> |
| 8 | /* Debug borders */ |
| 9 | p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { |
| 10 | /* |
| 11 | border: 1px solid red; |
| 12 | */ |
| 13 | } |
| 14 | |
| 15 | body { |
| 16 | margin: 1em 5% 1em 5%; |
| 17 | } |
| 18 | |
| 19 | a { color: blue; } |
| 20 | a:visited { color: fuchsia; } |
| 21 | |
| 22 | em { |
| 23 | font-style: italic; |
| 24 | } |
| 25 | |
| 26 | strong { |
| 27 | font-weight: bold; |
| 28 | } |
| 29 | |
| 30 | tt { |
| 31 | color: navy; |
| 32 | } |
| 33 | |
| 34 | h1, h2, h3, h4, h5, h6 { |
| 35 | color: #527bbd; |
| 36 | font-family: sans-serif; |
| 37 | margin-top: 1.2em; |
| 38 | margin-bottom: 0.5em; |
| 39 | line-height: 1.3; |
| 40 | } |
| 41 | |
| 42 | h1 { |
| 43 | border-bottom: 2px solid silver; |
| 44 | } |
| 45 | h2 { |
| 46 | border-bottom: 2px solid silver; |
| 47 | padding-top: 0.5em; |
| 48 | } |
| 49 | |
| 50 | div.sectionbody { |
| 51 | font-family: serif; |
| 52 | margin-left: 0; |
| 53 | } |
| 54 | |
| 55 | hr { |
| 56 | border: 1px solid silver; |
| 57 | } |
| 58 | |
| 59 | p { |
| 60 | margin-top: 0.5em; |
| 61 | margin-bottom: 0.5em; |
| 62 | } |
| 63 | |
| 64 | pre { |
| 65 | padding: 0; |
| 66 | margin: 0; |
| 67 | } |
| 68 | |
| 69 | span#author { |
| 70 | color: #527bbd; |
| 71 | font-family: sans-serif; |
| 72 | font-weight: bold; |
| 73 | font-size: 1.2em; |
| 74 | } |
| 75 | span#email { |
| 76 | } |
| 77 | span#revision { |
| 78 | font-family: sans-serif; |
| 79 | } |
| 80 | |
| 81 | div#footer { |
| 82 | font-family: sans-serif; |
| 83 | font-size: small; |
| 84 | border-top: 2px solid silver; |
| 85 | padding-top: 0.5em; |
| 86 | margin-top: 4.0em; |
| 87 | } |
| 88 | div#footer-text { |
| 89 | float: left; |
| 90 | padding-bottom: 0.5em; |
| 91 | } |
| 92 | div#footer-badges { |
| 93 | float: right; |
| 94 | padding-bottom: 0.5em; |
| 95 | } |
| 96 | |
| 97 | div#preamble, |
| 98 | div.tableblock, div.imageblock, div.exampleblock, div.verseblock, |
| 99 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 100 | div.admonitionblock { |
| 101 | margin-right: 10%; |
| 102 | margin-top: 1.5em; |
| 103 | margin-bottom: 1.5em; |
| 104 | } |
| 105 | div.admonitionblock { |
| 106 | margin-top: 2.5em; |
| 107 | margin-bottom: 2.5em; |
| 108 | } |
| 109 | |
| 110 | div.content { /* Block element content. */ |
| 111 | padding: 0; |
| 112 | } |
| 113 | |
| 114 | /* Block element titles. */ |
| 115 | div.title, caption.title { |
| 116 | font-family: sans-serif; |
| 117 | font-weight: bold; |
| 118 | text-align: left; |
| 119 | margin-top: 1.0em; |
| 120 | margin-bottom: 0.5em; |
| 121 | } |
| 122 | div.title + * { |
| 123 | margin-top: 0; |
| 124 | } |
| 125 | |
| 126 | td div.title:first-child { |
| 127 | margin-top: 0.0em; |
| 128 | } |
| 129 | div.content div.title:first-child { |
| 130 | margin-top: 0.0em; |
| 131 | } |
| 132 | div.content + div.title { |
| 133 | margin-top: 0.0em; |
| 134 | } |
| 135 | |
| 136 | div.sidebarblock > div.content { |
| 137 | background: #ffffee; |
| 138 | border: 1px solid silver; |
| 139 | padding: 0.5em; |
| 140 | } |
| 141 | |
| 142 | div.listingblock > div.content { |
| 143 | border: 1px solid silver; |
| 144 | background: #f4f4f4; |
| 145 | padding: 0.5em; |
| 146 | } |
| 147 | |
| 148 | div.quoteblock > div.content { |
| 149 | padding-left: 2.0em; |
| 150 | } |
| 151 | div.quoteblock .attribution { |
| 152 | text-align: right; |
| 153 | } |
| 154 | |
| 155 | div.admonitionblock .icon { |
| 156 | vertical-align: top; |
| 157 | font-size: 1.1em; |
| 158 | font-weight: bold; |
| 159 | text-decoration: underline; |
| 160 | color: #527bbd; |
| 161 | padding-right: 0.5em; |
| 162 | } |
| 163 | div.admonitionblock td.content { |
| 164 | padding-left: 0.5em; |
| 165 | border-left: 2px solid silver; |
| 166 | } |
| 167 | |
| 168 | div.exampleblock > div.content { |
| 169 | border-left: 2px solid silver; |
| 170 | padding: 0.5em; |
| 171 | } |
| 172 | |
| 173 | div.verseblock div.content { |
| 174 | white-space: pre; |
| 175 | } |
| 176 | |
| 177 | div.imageblock div.content { padding-left: 0; } |
| 178 | div.imageblock img { border: 1px solid silver; } |
| 179 | span.image img { border-style: none; } |
| 180 | |
| 181 | dl { |
| 182 | margin-top: 0.8em; |
| 183 | margin-bottom: 0.8em; |
| 184 | } |
| 185 | dt { |
| 186 | margin-top: 0.5em; |
| 187 | margin-bottom: 0; |
| 188 | font-style: italic; |
| 189 | } |
| 190 | dd > *:first-child { |
| 191 | margin-top: 0; |
| 192 | } |
| 193 | |
| 194 | ul, ol { |
| 195 | list-style-position: outside; |
| 196 | } |
| 197 | ol.olist2 { |
| 198 | list-style-type: lower-alpha; |
| 199 | } |
| 200 | |
| 201 | div.tableblock > table { |
| 202 | border-color: #527bbd; |
| 203 | border-width: 3px; |
| 204 | } |
| 205 | thead { |
| 206 | font-family: sans-serif; |
| 207 | font-weight: bold; |
| 208 | } |
| 209 | tfoot { |
| 210 | font-weight: bold; |
| 211 | } |
| 212 | |
| 213 | div.hlist { |
| 214 | margin-top: 0.8em; |
| 215 | margin-bottom: 0.8em; |
| 216 | } |
| 217 | td.hlist1 { |
| 218 | vertical-align: top; |
| 219 | font-style: italic; |
| 220 | padding-right: 0.8em; |
| 221 | } |
| 222 | td.hlist2 { |
| 223 | vertical-align: top; |
| 224 | } |
| 225 | |
| 226 | @media print { |
| 227 | div#footer-badges { display: none; } |
| 228 | } |
| 229 | include::./stylesheets/xhtml11-manpage.css[] |
| 230 | /* Workarounds for IE6's broken and incomplete CSS2. */ |
| 231 | |
| 232 | div.sidebar-content { |
| 233 | background: #ffffee; |
| 234 | border: 1px solid silver; |
| 235 | padding: 0.5em; |
| 236 | } |
| 237 | div.sidebar-title, div.image-title { |
| 238 | font-family: sans-serif; |
| 239 | font-weight: bold; |
| 240 | margin-top: 0.0em; |
| 241 | margin-bottom: 0.5em; |
| 242 | } |
| 243 | |
| 244 | div.listingblock div.content { |
| 245 | border: 1px solid silver; |
| 246 | background: #f4f4f4; |
| 247 | padding: 0.5em; |
| 248 | } |
| 249 | |
| 250 | div.quoteblock-content { |
| 251 | padding-left: 2.0em; |
| 252 | } |
| 253 | |
| 254 | div.exampleblock-content { |
| 255 | border-left: 2px solid silver; |
| 256 | padding-left: 0.5em; |
| 257 | } |
| 258 | </style> |
| 259 | <title>git-update-index(1)</title> |
| 260 | </head> |
| 261 | <body> |
| 262 | <div id="header"> |
| 263 | <h1> |
| 264 | git-update-index(1) Manual Page |
| 265 | </h1> |
| 266 | <h2>NAME</h2> |
| 267 | <div class="sectionbody"> |
| 268 | <p>git-update-index - |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 269 | Register file contents in the working tree to the index |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 270 | </p> |
| 271 | </div> |
| 272 | </div> |
| 273 | <h2>SYNOPSIS</h2> |
| 274 | <div class="sectionbody"> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 275 | <div class="verseblock"> |
| 276 | <div class="content"><em>git-update-index</em> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 277 | [--add] [--remove | --force-remove] [--replace] |
Junio C Hamano | 46338f5 | 2006-05-04 00:46:44 | [diff] [blame] | 278 | [--refresh] [-q] [--unmerged] [--ignore-missing] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 279 | [--cacheinfo <mode> <object> <file>]* |
| 280 | [--chmod=(+|-)x] |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 281 | [--assume-unchanged | --no-assume-unchanged] |
Junio C Hamano | 8a0a21e | 2006-08-24 07:37:45 | [diff] [blame] | 282 | [--really-refresh] [--unresolve] [--again | -g] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 283 | [--info-only] [--index-info] |
| 284 | [-z] [--stdin] |
| 285 | [--verbose] |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 286 | [--] [<file>]*</div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 287 | </div> |
| 288 | <h2>DESCRIPTION</h2> |
| 289 | <div class="sectionbody"> |
| 290 | <p>Modifies the index or directory cache. Each file mentioned is updated |
| 291 | into the index and any <em>unmerged</em> or <em>needs updating</em> state is |
| 292 | cleared.</p> |
| 293 | <p>The way "git-update-index" handles files it is told about can be modified |
| 294 | using the various options:</p> |
| 295 | </div> |
| 296 | <h2>OPTIONS</h2> |
| 297 | <div class="sectionbody"> |
| 298 | <dl> |
| 299 | <dt> |
| 300 | --add |
| 301 | </dt> |
| 302 | <dd> |
| 303 | <p> |
| 304 | If a specified file isn't in the index already then it's |
| 305 | added. |
| 306 | Default behaviour is to ignore new files. |
| 307 | </p> |
| 308 | </dd> |
| 309 | <dt> |
| 310 | --remove |
| 311 | </dt> |
| 312 | <dd> |
| 313 | <p> |
| 314 | If a specified file is in the index but is missing then it's |
| 315 | removed. |
Junio C Hamano | 341071d | 2006-06-04 07:24:48 | [diff] [blame] | 316 | Default behavior is to ignore removed file. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 317 | </p> |
| 318 | </dd> |
| 319 | <dt> |
| 320 | --refresh |
| 321 | </dt> |
| 322 | <dd> |
| 323 | <p> |
| 324 | Looks at the current index and checks to see if merges or |
| 325 | updates are needed by checking stat() information. |
| 326 | </p> |
| 327 | </dd> |
| 328 | <dt> |
| 329 | -q |
| 330 | </dt> |
| 331 | <dd> |
| 332 | <p> |
| 333 | Quiet. If --refresh finds that the index needs an update, the |
| 334 | default behavior is to error out. This option makes |
| 335 | git-update-index continue anyway. |
| 336 | </p> |
| 337 | </dd> |
| 338 | <dt> |
| 339 | --unmerged |
| 340 | </dt> |
| 341 | <dd> |
| 342 | <p> |
| 343 | If --refresh finds unmerged changes in the index, the default |
| 344 | behavior is to error out. This option makes git-update-index |
| 345 | continue anyway. |
| 346 | </p> |
| 347 | </dd> |
| 348 | <dt> |
| 349 | --ignore-missing |
| 350 | </dt> |
| 351 | <dd> |
| 352 | <p> |
| 353 | Ignores missing files during a --refresh |
| 354 | </p> |
| 355 | </dd> |
| 356 | <dt> |
| 357 | --cacheinfo <mode> <object> <path> |
| 358 | </dt> |
| 359 | <dd> |
| 360 | <p> |
| 361 | Directly insert the specified info into the index. |
| 362 | </p> |
| 363 | </dd> |
| 364 | <dt> |
| 365 | --index-info |
| 366 | </dt> |
| 367 | <dd> |
| 368 | <p> |
| 369 | Read index information from stdin. |
| 370 | </p> |
| 371 | </dd> |
| 372 | <dt> |
| 373 | --chmod=(+|-)x |
| 374 | </dt> |
| 375 | <dd> |
| 376 | <p> |
| 377 | Set the execute permissions on the updated files. |
| 378 | </p> |
| 379 | </dd> |
| 380 | <dt> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 381 | --assume-unchanged, --no-assume-unchanged |
| 382 | </dt> |
| 383 | <dd> |
| 384 | <p> |
| 385 | When these flags are specified, the object name recorded |
| 386 | for the paths are not updated. Instead, these options |
| 387 | sets and unsets the "assume unchanged" bit for the |
| 388 | paths. When the "assume unchanged" bit is on, git stops |
| 389 | checking the working tree files for possible |
| 390 | modifications, so you need to manually unset the bit to |
| 391 | tell git when you change the working tree file. This is |
| 392 | sometimes helpful when working with a big project on a |
| 393 | filesystem that has very slow lstat(2) system call |
| 394 | (e.g. cifs). |
| 395 | </p> |
| 396 | </dd> |
| 397 | <dt> |
Junio C Hamano | 8a0a21e | 2006-08-24 07:37:45 | [diff] [blame] | 398 | --again, -g |
Junio C Hamano | 26a5737 | 2006-05-10 00:13:40 | [diff] [blame] | 399 | </dt> |
| 400 | <dd> |
| 401 | <p> |
| 402 | Runs <tt>git-update-index</tt> itself on the paths whose index |
| 403 | entries are different from those from the <tt>HEAD</tt> commit. |
| 404 | </p> |
| 405 | </dd> |
| 406 | <dt> |
Junio C Hamano | 46338f5 | 2006-05-04 00:46:44 | [diff] [blame] | 407 | --unresolve |
| 408 | </dt> |
| 409 | <dd> |
| 410 | <p> |
| 411 | Restores the <em>unmerged</em> or <em>needs updating</em> state of a |
| 412 | file during a merge if it was cleared by accident. |
| 413 | </p> |
| 414 | </dd> |
| 415 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 416 | --info-only |
| 417 | </dt> |
| 418 | <dd> |
| 419 | <p> |
| 420 | Do not create objects in the object database for all |
| 421 | <file> arguments that follow this flag; just insert |
| 422 | their object IDs into the index. |
| 423 | </p> |
| 424 | </dd> |
| 425 | <dt> |
| 426 | --force-remove |
| 427 | </dt> |
| 428 | <dd> |
| 429 | <p> |
| 430 | Remove the file from the index even when the working directory |
| 431 | still has such a file. (Implies --remove.) |
| 432 | </p> |
| 433 | </dd> |
| 434 | <dt> |
| 435 | --replace |
| 436 | </dt> |
| 437 | <dd> |
| 438 | <p> |
| 439 | By default, when a file <tt>path</tt> exists in the index, |
| 440 | git-update-index refuses an attempt to add <tt>path/file</tt>. |
| 441 | Similarly if a file <tt>path/file</tt> exists, a file <tt>path</tt> |
| 442 | cannot be added. With --replace flag, existing entries |
| 443 | that conflicts with the entry being added are |
| 444 | automatically removed with warning messages. |
| 445 | </p> |
| 446 | </dd> |
| 447 | <dt> |
| 448 | --stdin |
| 449 | </dt> |
| 450 | <dd> |
| 451 | <p> |
| 452 | Instead of taking list of paths from the command line, |
| 453 | read list of paths from the standard input. Paths are |
| 454 | separated by LF (i.e. one path per line) by default. |
| 455 | </p> |
| 456 | </dd> |
| 457 | <dt> |
| 458 | --verbose |
| 459 | </dt> |
| 460 | <dd> |
| 461 | <p> |
| 462 | Report what is being added and removed from index. |
| 463 | </p> |
| 464 | </dd> |
| 465 | <dt> |
| 466 | -z |
| 467 | </dt> |
| 468 | <dd> |
| 469 | <p> |
| 470 | Only meaningful with <tt>--stdin</tt>; paths are separated with |
| 471 | NUL character instead of LF. |
| 472 | </p> |
| 473 | </dd> |
| 474 | <dt> |
Junio C Hamano | 1bb569e | 2006-05-05 23:14:25 | [diff] [blame] | 475 | -- |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 476 | </dt> |
| 477 | <dd> |
| 478 | <p> |
| 479 | Do not interpret any more arguments as options. |
| 480 | </p> |
| 481 | </dd> |
| 482 | <dt> |
| 483 | <file> |
| 484 | </dt> |
| 485 | <dd> |
| 486 | <p> |
| 487 | Files to act on. |
| 488 | Note that files beginning with <em>.</em> are discarded. This includes |
| 489 | <tt>./file</tt> and <tt>dir/./file</tt>. If you don't want this, then use |
| 490 | cleaner names. |
| 491 | The same applies to directories ending <em>/</em> and paths with <em>//</em> |
| 492 | </p> |
| 493 | </dd> |
| 494 | </dl> |
| 495 | </div> |
| 496 | <h2>Using --refresh</h2> |
| 497 | <div class="sectionbody"> |
| 498 | <p><em>--refresh</em> does not calculate a new sha1 file or bring the index |
| 499 | up-to-date for mode/content changes. But what it <strong>does</strong> do is to |
| 500 | "re-match" the stat information of a file with the index, so that you |
| 501 | can refresh the index for a file that hasn't been changed but where |
| 502 | the stat entry is out of date.</p> |
| 503 | <p>For example, you'd want to do this after doing a "git-read-tree", to link |
| 504 | up the stat index details with the proper files.</p> |
| 505 | </div> |
| 506 | <h2>Using --cacheinfo or --info-only</h2> |
| 507 | <div class="sectionbody"> |
| 508 | <p><em>--cacheinfo</em> is used to register a file that is not in the |
| 509 | current working directory. This is useful for minimum-checkout |
| 510 | merging.</p> |
| 511 | <p>To pretend you have a file with mode and sha1 at path, say:</p> |
| 512 | <div class="listingblock"> |
| 513 | <div class="content"> |
| 514 | <pre><tt>$ git-update-index --cacheinfo mode sha1 path</tt></pre> |
| 515 | </div></div> |
| 516 | <p><em>--info-only</em> is used to register files without placing them in the object |
| 517 | database. This is useful for status-only repositories.</p> |
| 518 | <p>Both <em>--cacheinfo</em> and <em>--info-only</em> behave similarly: the index is updated |
| 519 | but the object database isn't. <em>--cacheinfo</em> is useful when the object is |
| 520 | in the database but the file isn't available locally. <em>--info-only</em> is |
| 521 | useful when the file is available, but you do not wish to update the |
| 522 | object database.</p> |
| 523 | </div> |
| 524 | <h2>Using --index-info</h2> |
| 525 | <div class="sectionbody"> |
| 526 | <p><tt>--index-info</tt> is a more powerful mechanism that lets you feed |
| 527 | multiple entry definitions from the standard input, and designed |
| 528 | specifically for scripts. It can take inputs of three formats:</p> |
| 529 | <ol> |
| 530 | <li> |
| 531 | <p> |
| 532 | mode SP sha1 TAB path |
| 533 | </p> |
| 534 | <p>The first format is what "git-apply --index-info" |
| 535 | reports, and used to reconstruct a partial tree |
| 536 | that is used for phony merge base tree when falling |
| 537 | back on 3-way merge.</p> |
| 538 | </li> |
| 539 | <li> |
| 540 | <p> |
| 541 | mode SP type SP sha1 TAB path |
| 542 | </p> |
| 543 | <p>The second format is to stuff git-ls-tree output |
| 544 | into the index file.</p> |
| 545 | </li> |
| 546 | <li> |
| 547 | <p> |
| 548 | mode SP sha1 SP stage TAB path |
| 549 | </p> |
| 550 | <p>This format is to put higher order stages into the |
| 551 | index file and matches git-ls-files --stage output.</p> |
| 552 | </li> |
| 553 | </ol> |
| 554 | <p>To place a higher stage entry to the index, the path should |
| 555 | first be removed by feeding a mode=0 entry for the path, and |
| 556 | then feeding necessary input lines in the third format.</p> |
| 557 | <p>For example, starting with this index:</p> |
| 558 | <div class="listingblock"> |
| 559 | <div class="content"> |
| 560 | <pre><tt>$ git ls-files -s |
| 561 | 100644 8a1218a1024a212bb3db30becd860315f9f3ac52 0 frotz</tt></pre> |
| 562 | </div></div> |
| 563 | <p>you can feed the following input to <tt>--index-info</tt>:</p> |
| 564 | <div class="listingblock"> |
| 565 | <div class="content"> |
| 566 | <pre><tt>$ git update-index --index-info |
| 567 | 0 0000000000000000000000000000000000000000 frotz |
| 568 | 100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1 frotz |
| 569 | 100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2 frotz</tt></pre> |
| 570 | </div></div> |
| 571 | <p>The first line of the input feeds 0 as the mode to remove the |
| 572 | path; the SHA1 does not matter as long as it is well formatted. |
| 573 | Then the second and third line feeds stage 1 and stage 2 entries |
| 574 | for that path. After the above, we would end up with this:</p> |
| 575 | <div class="listingblock"> |
| 576 | <div class="content"> |
| 577 | <pre><tt>$ git ls-files -s |
| 578 | 100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1 frotz |
| 579 | 100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2 frotz</tt></pre> |
| 580 | </div></div> |
| 581 | </div> |
Junio C Hamano | fb2ead3 | 2006-11-13 23:40:59 | [diff] [blame] | 582 | <h2>Using “assume unchanged” bit</h2> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 583 | <div class="sectionbody"> |
| 584 | <p>Many operations in git depend on your filesystem to have an |
| 585 | efficient <tt>lstat(2)</tt> implementation, so that <tt>st_mtime</tt> |
| 586 | information for working tree files can be cheaply checked to see |
| 587 | if the file contents have changed from the version recorded in |
| 588 | the index file. Unfortunately, some filesystems have |
| 589 | inefficient <tt>lstat(2)</tt>. If your filesystem is one of them, you |
| 590 | can set "assume unchanged" bit to paths you have not changed to |
| 591 | cause git not to do this check. Note that setting this bit on a |
| 592 | path does not mean git will check the contents of the file to |
| 593 | see if it has changed — it makes git to omit any checking and |
| 594 | assume it has <strong>not</strong> changed. When you make changes to working |
| 595 | tree files, you have to explicitly tell git about it by dropping |
| 596 | "assume unchanged" bit, either before or after you modify them.</p> |
| 597 | <p>In order to set "assume unchanged" bit, use <tt>--assume-unchanged</tt> |
| 598 | option. To unset, use <tt>--no-assume-unchanged</tt>.</p> |
| 599 | <p>The command looks at <tt>core.ignorestat</tt> configuration variable. When |
| 600 | this is true, paths updated with <tt>git-update-index paths…</tt> and |
| 601 | paths updated with other git commands that update both index and |
| 602 | working tree (e.g. <tt>git-apply --index</tt>, <tt>git-checkout-index -u</tt>, |
| 603 | and <tt>git-read-tree -u</tt>) are automatically marked as "assume |
| 604 | unchanged". Note that "assume unchanged" bit is <strong>not</strong> set if |
| 605 | <tt>git-update-index --refresh</tt> finds the working tree file matches |
| 606 | the index (use <tt>git-update-index --really-refresh</tt> if you want |
| 607 | to mark them as "assume unchanged").</p> |
| 608 | </div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 609 | <h2>Examples</h2> |
| 610 | <div class="sectionbody"> |
| 611 | <p>To update and refresh only the files already checked out:</p> |
| 612 | <div class="listingblock"> |
| 613 | <div class="content"> |
| 614 | <pre><tt>$ git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh</tt></pre> |
| 615 | </div></div> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 616 | <dl> |
| 617 | <dt> |
| 618 | On an inefficient filesystem with <tt>core.ignorestat</tt> set |
| 619 | </dt> |
| 620 | <dd> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 621 | <div class="listingblock"> |
| 622 | <div class="content"> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 623 | <pre><tt>$ git update-index --really-refresh <b>(1)</b> |
| 624 | $ git update-index --no-assume-unchanged foo.c <b>(2)</b> |
| 625 | $ git diff --name-only <b>(3)</b> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 626 | $ edit foo.c |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 627 | $ git diff --name-only <b>(4)</b> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 628 | M foo.c |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 629 | $ git update-index foo.c <b>(5)</b> |
| 630 | $ git diff --name-only <b>(6)</b> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 631 | $ edit foo.c |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 632 | $ git diff --name-only <b>(7)</b> |
| 633 | $ git update-index --no-assume-unchanged foo.c <b>(8)</b> |
| 634 | $ git diff --name-only <b>(9)</b> |
| 635 | M foo.c</tt></pre> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 636 | </div></div> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 637 | <ol> |
| 638 | <li> |
| 639 | <p> |
| 640 | forces lstat(2) to set "assume unchanged" bits for paths that match index. |
| 641 | </p> |
| 642 | </li> |
| 643 | <li> |
| 644 | <p> |
| 645 | mark the path to be edited. |
| 646 | </p> |
| 647 | </li> |
| 648 | <li> |
| 649 | <p> |
| 650 | this does lstat(2) and finds index matches the path. |
| 651 | </p> |
| 652 | </li> |
| 653 | <li> |
| 654 | <p> |
| 655 | this does lstat(2) and finds index does <strong>not</strong> match the path. |
| 656 | </p> |
| 657 | </li> |
| 658 | <li> |
| 659 | <p> |
| 660 | registering the new version to index sets "assume unchanged" bit. |
| 661 | </p> |
| 662 | </li> |
| 663 | <li> |
| 664 | <p> |
| 665 | and it is assumed unchanged. |
| 666 | </p> |
| 667 | </li> |
| 668 | <li> |
| 669 | <p> |
| 670 | even after you edit it. |
| 671 | </p> |
| 672 | </li> |
| 673 | <li> |
| 674 | <p> |
| 675 | you can tell about the change after the fact. |
| 676 | </p> |
| 677 | </li> |
| 678 | <li> |
| 679 | <p> |
| 680 | now it checks with lstat(2) and finds it has been changed. |
| 681 | </p> |
| 682 | </li> |
| 683 | </ol> |
| 684 | </dd> |
| 685 | </dl> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 686 | </div> |
| 687 | <h2>Configuration</h2> |
| 688 | <div class="sectionbody"> |
| 689 | <p>The command honors <tt>core.filemode</tt> configuration variable. If |
| 690 | your repository is on an filesystem whose executable bits are |
Junio C Hamano | 7ad22dc | 2007-01-29 02:55:48 | [diff] [blame] | 691 | unreliable, this should be set to <em>false</em> (see <a href="git-config.html">git-config(1)</a>). |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 692 | This causes the command to ignore differences in file modes recorded |
| 693 | in the index and the file mode on the filesystem if they differ only on |
| 694 | executable bit. On such an unfortunate filesystem, you may |
| 695 | need to use <tt>git-update-index --chmod=</tt>.</p> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 696 | <p>The command looks at <tt>core.ignorestat</tt> configuration variable. See |
| 697 | <em>Using "assume unchanged" bit</em> section above.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 698 | </div> |
| 699 | <h2>See Also</h2> |
| 700 | <div class="sectionbody"> |
Junio C Hamano | 7ad22dc | 2007-01-29 02:55:48 | [diff] [blame] | 701 | <p><a href="git-config.html">git-config(1)</a></p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 702 | </div> |
| 703 | <h2>Author</h2> |
| 704 | <div class="sectionbody"> |
| 705 | <p>Written by Linus Torvalds <torvalds@osdl.org></p> |
| 706 | </div> |
| 707 | <h2>Documentation</h2> |
| 708 | <div class="sectionbody"> |
| 709 | <p>Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.</p> |
| 710 | </div> |
| 711 | <h2>GIT</h2> |
| 712 | <div class="sectionbody"> |
| 713 | <p>Part of the <a href="git.html">git(7)</a> suite</p> |
| 714 | </div> |
| 715 | <div id="footer"> |
| 716 | <div id="footer-text"> |
Junio C Hamano | 7ad22dc | 2007-01-29 02:55:48 | [diff] [blame] | 717 | Last updated 29-Jan-2007 02:55:12 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 718 | </div> |
| 719 | </div> |
| 720 | </body> |
| 721 | </html> |