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 | decf50e | 2006-03-05 10:51:14 | [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-checkout-index(1)</title> |
| 260 | </head> |
| 261 | <body> |
| 262 | <div id="header"> |
| 263 | <h1> |
| 264 | git-checkout-index(1) Manual Page |
| 265 | </h1> |
| 266 | <h2>NAME</h2> |
| 267 | <div class="sectionbody"> |
| 268 | <p>git-checkout-index - |
| 269 | Copy files from the index to the working directory |
| 270 | </p> |
| 271 | </div> |
| 272 | </div> |
| 273 | <h2>SYNOPSIS</h2> |
| 274 | <div class="sectionbody"> |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 275 | <div class="verseblock"> |
| 276 | <div class="content"><em>git-checkout-index</em> [-u] [-q] [-a] [-f] [-n] [--prefix=<string>] |
Junio C Hamano | f84a2b1 | 2006-03-07 05:16:28 | [diff] [blame] | 277 | [--stage=<number>|all] |
| 278 | [--temp] |
Junio C Hamano | decf50e | 2006-03-05 10:51:14 | [diff] [blame] | 279 | [-z] [--stdin] |
| 280 | [--] [<file>]*</div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 281 | </div> |
| 282 | <h2>DESCRIPTION</h2> |
| 283 | <div class="sectionbody"> |
| 284 | <p>Will copy all files listed from the index to the working directory |
| 285 | (not overwriting existing files).</p> |
| 286 | </div> |
| 287 | <h2>OPTIONS</h2> |
| 288 | <div class="sectionbody"> |
| 289 | <dl> |
| 290 | <dt> |
| 291 | -u|--index |
| 292 | </dt> |
| 293 | <dd> |
| 294 | <p> |
| 295 | update stat information for the checked out entries in |
| 296 | the index file. |
| 297 | </p> |
| 298 | </dd> |
| 299 | <dt> |
| 300 | -q|--quiet |
| 301 | </dt> |
| 302 | <dd> |
| 303 | <p> |
| 304 | be quiet if files exist or are not in the index |
| 305 | </p> |
| 306 | </dd> |
| 307 | <dt> |
| 308 | -f|--force |
| 309 | </dt> |
| 310 | <dd> |
| 311 | <p> |
| 312 | forces overwrite of existing files |
| 313 | </p> |
| 314 | </dd> |
| 315 | <dt> |
| 316 | -a|--all |
| 317 | </dt> |
| 318 | <dd> |
| 319 | <p> |
| 320 | checks out all files in the index. Cannot be used |
| 321 | together with explicit filenames. |
| 322 | </p> |
| 323 | </dd> |
| 324 | <dt> |
| 325 | -n|--no-create |
| 326 | </dt> |
| 327 | <dd> |
| 328 | <p> |
| 329 | Don't checkout new files, only refresh files already checked |
| 330 | out. |
| 331 | </p> |
| 332 | </dd> |
| 333 | <dt> |
| 334 | --prefix=<string> |
| 335 | </dt> |
| 336 | <dd> |
| 337 | <p> |
| 338 | When creating files, prepend <string> (usually a directory |
| 339 | including a trailing /) |
| 340 | </p> |
| 341 | </dd> |
| 342 | <dt> |
Junio C Hamano | f84a2b1 | 2006-03-07 05:16:28 | [diff] [blame] | 343 | --stage=<number>|all |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 344 | </dt> |
| 345 | <dd> |
| 346 | <p> |
| 347 | Instead of checking out unmerged entries, copy out the |
| 348 | files from named stage. <number> must be between 1 and 3. |
Junio C Hamano | f84a2b1 | 2006-03-07 05:16:28 | [diff] [blame] | 349 | Note: --stage=all automatically implies --temp. |
| 350 | </p> |
| 351 | </dd> |
| 352 | <dt> |
| 353 | --temp |
| 354 | </dt> |
| 355 | <dd> |
| 356 | <p> |
| 357 | Instead of copying the files to the working directory |
| 358 | write the content to temporary files. The temporary name |
| 359 | associations will be written to stdout. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 360 | </p> |
| 361 | </dd> |
| 362 | <dt> |
Junio C Hamano | decf50e | 2006-03-05 10:51:14 | [diff] [blame] | 363 | --stdin |
| 364 | </dt> |
| 365 | <dd> |
| 366 | <p> |
| 367 | Instead of taking list of paths from the command line, |
| 368 | read list of paths from the standard input. Paths are |
| 369 | separated by LF (i.e. one path per line) by default. |
| 370 | </p> |
| 371 | </dd> |
| 372 | <dt> |
| 373 | -z |
| 374 | </dt> |
| 375 | <dd> |
| 376 | <p> |
| 377 | Only meaningful with <tt>--stdin</tt>; paths are separated with |
| 378 | NUL character instead of LF. |
| 379 | </p> |
| 380 | </dd> |
| 381 | <dt> |
Junio C Hamano | 1bb569e | 2006-05-05 23:14:25 | [diff] [blame^] | 382 | -- |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 383 | </dt> |
| 384 | <dd> |
| 385 | <p> |
| 386 | Do not interpret any more arguments as options. |
| 387 | </p> |
| 388 | </dd> |
| 389 | </dl> |
| 390 | <p>The order of the flags used to matter, but not anymore.</p> |
| 391 | <p>Just doing <tt>git-checkout-index</tt> does nothing. You probably meant |
| 392 | <tt>git-checkout-index -a</tt>. And if you want to force it, you want |
| 393 | <tt>git-checkout-index -f -a</tt>.</p> |
| 394 | <p>Intuitiveness is not the goal here. Repeatability is. The reason for |
| 395 | the "no arguments means no work" behavior is that from scripts you are |
| 396 | supposed to be able to do:</p> |
| 397 | <div class="listingblock"> |
| 398 | <div class="content"> |
| 399 | <pre><tt>$ find . -name '*.h' -print0 | xargs -0 git-checkout-index -f --</tt></pre> |
| 400 | </div></div> |
| 401 | <p>which will force all existing <tt>*.h</tt> files to be replaced with their |
| 402 | cached copies. If an empty command line implied "all", then this would |
Junio C Hamano | decf50e | 2006-03-05 10:51:14 | [diff] [blame] | 403 | force-refresh everything in the index, which was not the point. But |
| 404 | since git-checkout-index accepts --stdin it would be faster to use:</p> |
| 405 | <div class="listingblock"> |
| 406 | <div class="content"> |
| 407 | <pre><tt>$ find . -name '*.h' -print0 | git-checkout-index -f -z --stdin</tt></pre> |
| 408 | </div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 409 | <p>The <tt>--</tt> is just a good idea when you know the rest will be filenames; |
| 410 | it will prevent problems with a filename of, for example, <tt>-a</tt>. |
| 411 | Using <tt>--</tt> is probably a good policy in scripts.</p> |
| 412 | </div> |
Junio C Hamano | f84a2b1 | 2006-03-07 05:16:28 | [diff] [blame] | 413 | <h2>Using --temp or --stage=all</h2> |
| 414 | <div class="sectionbody"> |
| 415 | <p>When <tt>--temp</tt> is used (or implied by <tt>--stage=all</tt>) |
| 416 | <tt>git-checkout-index</tt> will create a temporary file for each index |
| 417 | entry being checked out. The index will not be updated with stat |
| 418 | information. These options can be useful if the caller needs all |
| 419 | stages of all unmerged entries so that the unmerged files can be |
| 420 | processed by an external merge tool.</p> |
| 421 | <p>A listing will be written to stdout providing the association of |
| 422 | temporary file names to tracked path names. The listing format |
| 423 | has two variations:</p> |
| 424 | <ol> |
| 425 | <li> |
| 426 | <p> |
| 427 | tempname TAB path RS |
| 428 | </p> |
| 429 | <p>The first format is what gets used when <tt>--stage</tt> is omitted or |
| 430 | is not <tt>--stage=all</tt>. The field tempname is the temporary file |
| 431 | name holding the file content and path is the tracked path name in |
| 432 | the index. Only the requested entries are output.</p> |
| 433 | </li> |
| 434 | <li> |
| 435 | <p> |
| 436 | stage1temp SP stage2temp SP stage3tmp TAB path RS |
| 437 | </p> |
| 438 | <p>The second format is what gets used when <tt>--stage=all</tt>. The three |
| 439 | stage temporary fields (stage1temp, stage2temp, stage3temp) list the |
| 440 | name of the temporary file if there is a stage entry in the index |
| 441 | or <tt>.</tt> if there is no stage entry. Paths which only have a stage 0 |
| 442 | entry will always be omitted from the output.</p> |
| 443 | </li> |
| 444 | </ol> |
| 445 | <p>In both formats RS (the record separator) is newline by default |
| 446 | but will be the null byte if -z was passed on the command line. |
| 447 | The temporary file names are always safe strings; they will never |
| 448 | contain directory separators or whitespace characters. The path |
| 449 | field is always relative to the current directory and the temporary |
| 450 | file names are always relative to the top level directory.</p> |
| 451 | <p>If the object being copied out to a temporary file is a symbolic |
| 452 | link the content of the link will be written to a normal file. It is |
| 453 | up to the end-user or the Porcelain to make use of this information.</p> |
| 454 | </div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 455 | <h2>EXAMPLES</h2> |
| 456 | <div class="sectionbody"> |
| 457 | <dl> |
| 458 | <dt> |
| 459 | To update and refresh only the files already checked out |
| 460 | </dt> |
| 461 | <dd> |
| 462 | <div class="listingblock"> |
| 463 | <div class="content"> |
| 464 | <pre><tt>$ git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh</tt></pre> |
| 465 | </div></div> |
| 466 | </dd> |
| 467 | <dt> |
| 468 | Using <tt>git-checkout-index</tt> to "export an entire tree" |
| 469 | </dt> |
| 470 | <dd> |
| 471 | <p> |
| 472 | The prefix ability basically makes it trivial to use |
| 473 | <tt>git-checkout-index</tt> as an "export as tree" function. |
| 474 | Just read the desired tree into the index, and do: |
| 475 | </p> |
| 476 | <div class="listingblock"> |
| 477 | <div class="content"> |
| 478 | <pre><tt>$ git-checkout-index --prefix=git-export-dir/ -a</tt></pre> |
| 479 | </div></div> |
| 480 | <p><tt>git-checkout-index</tt> will "export" the index into the specified |
| 481 | directory.</p> |
| 482 | <p>The final "/" is important. The exported name is literally just |
| 483 | prefixed with the specified string. Contrast this with the |
| 484 | following example.</p> |
| 485 | </dd> |
| 486 | <dt> |
| 487 | Export files with a prefix |
| 488 | </dt> |
| 489 | <dd> |
| 490 | <div class="listingblock"> |
| 491 | <div class="content"> |
| 492 | <pre><tt>$ git-checkout-index --prefix=.merged- Makefile</tt></pre> |
| 493 | </div></div> |
| 494 | <p>This will check out the currently cached copy of <tt>Makefile</tt> |
| 495 | into the file <tt>.merged-Makefile</tt>.</p> |
| 496 | </dd> |
| 497 | </dl> |
| 498 | </div> |
| 499 | <h2>Author</h2> |
| 500 | <div class="sectionbody"> |
| 501 | <p>Written by Linus Torvalds <torvalds@osdl.org></p> |
| 502 | </div> |
| 503 | <h2>Documentation</h2> |
| 504 | <div class="sectionbody"> |
| 505 | <p>Documentation by David Greaves, |
| 506 | Junio C Hamano and the git-list <git@vger.kernel.org>.</p> |
| 507 | </div> |
| 508 | <h2>GIT</h2> |
| 509 | <div class="sectionbody"> |
| 510 | <p>Part of the <a href="git.html">git(7)</a> suite</p> |
| 511 | </div> |
| 512 | <div id="footer"> |
| 513 | <div id="footer-text"> |
Junio C Hamano | 1bb569e | 2006-05-05 23:14:25 | [diff] [blame^] | 514 | Last updated 05-May-2006 23:14:10 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 515 | </div> |
| 516 | </div> |
| 517 | </body> |
| 518 | </html> |