Autogenerated HTML docs for v1.7.7-290-gc9e7aa
[git/jnareb-git.git] / git-update-index.html
blob64b16409941e35cd8f3286350ac6938b71037450
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" />
6 <meta name="generator" content="AsciiDoc 8.5.2" />
7 <title>git-update-index(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.0em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.0em;
126 margin-bottom: 2.0em;
127 margin-right: 10%;
128 color: #606060;
131 div.content { /* Block element content. */
132 padding: 0;
135 /* Block element titles. */
136 div.title, caption.title {
137 color: #527bbd;
138 font-family: sans-serif;
139 font-weight: bold;
140 text-align: left;
141 margin-top: 1.0em;
142 margin-bottom: 0.5em;
144 div.title + * {
145 margin-top: 0;
148 td div.title:first-child {
149 margin-top: 0.0em;
151 div.content div.title:first-child {
152 margin-top: 0.0em;
154 div.content + div.title {
155 margin-top: 0.0em;
158 div.sidebarblock > div.content {
159 background: #ffffee;
160 border: 1px solid silver;
161 padding: 0.5em;
164 div.listingblock > div.content {
165 border: 1px solid silver;
166 background: #f4f4f4;
167 padding: 0.5em;
170 div.quoteblock, div.verseblock {
171 padding-left: 1.0em;
172 margin-left: 1.0em;
173 margin-right: 10%;
174 border-left: 5px solid #dddddd;
175 color: #777777;
178 div.quoteblock > div.attribution {
179 padding-top: 0.5em;
180 text-align: right;
183 div.verseblock > div.content {
184 white-space: pre;
186 div.verseblock > div.attribution {
187 padding-top: 0.75em;
188 text-align: left;
190 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
191 div.verseblock + div.attribution {
192 text-align: left;
195 div.admonitionblock .icon {
196 vertical-align: top;
197 font-size: 1.1em;
198 font-weight: bold;
199 text-decoration: underline;
200 color: #527bbd;
201 padding-right: 0.5em;
203 div.admonitionblock td.content {
204 padding-left: 0.5em;
205 border-left: 3px solid #dddddd;
208 div.exampleblock > div.content {
209 border-left: 3px solid #dddddd;
210 padding-left: 0.5em;
213 div.imageblock div.content { padding-left: 0; }
214 span.image img { border-style: none; }
215 a.image:visited { color: white; }
217 dl {
218 margin-top: 0.8em;
219 margin-bottom: 0.8em;
221 dt {
222 margin-top: 0.5em;
223 margin-bottom: 0;
224 font-style: normal;
225 color: navy;
227 dd > *:first-child {
228 margin-top: 0.1em;
231 ul, ol {
232 list-style-position: outside;
234 ol.arabic {
235 list-style-type: decimal;
237 ol.loweralpha {
238 list-style-type: lower-alpha;
240 ol.upperalpha {
241 list-style-type: upper-alpha;
243 ol.lowerroman {
244 list-style-type: lower-roman;
246 ol.upperroman {
247 list-style-type: upper-roman;
250 div.compact ul, div.compact ol,
251 div.compact p, div.compact p,
252 div.compact div, div.compact div {
253 margin-top: 0.1em;
254 margin-bottom: 0.1em;
257 div.tableblock > table {
258 border: 3px solid #527bbd;
260 thead, p.table.header {
261 font-family: sans-serif;
262 font-weight: bold;
264 tfoot {
265 font-weight: bold;
267 td > div.verse {
268 white-space: pre;
270 p.table {
271 margin-top: 0;
273 /* Because the table frame attribute is overriden by CSS in most browsers. */
274 div.tableblock > table[frame="void"] {
275 border-style: none;
277 div.tableblock > table[frame="hsides"] {
278 border-left-style: none;
279 border-right-style: none;
281 div.tableblock > table[frame="vsides"] {
282 border-top-style: none;
283 border-bottom-style: none;
287 div.hdlist {
288 margin-top: 0.8em;
289 margin-bottom: 0.8em;
291 div.hdlist tr {
292 padding-bottom: 15px;
294 dt.hdlist1.strong, td.hdlist1.strong {
295 font-weight: bold;
297 td.hdlist1 {
298 vertical-align: top;
299 font-style: normal;
300 padding-right: 0.8em;
301 color: navy;
303 td.hdlist2 {
304 vertical-align: top;
306 div.hdlist.compact tr {
307 margin: 0;
308 padding-bottom: 0;
311 .comment {
312 background: yellow;
315 .footnote, .footnoteref {
316 font-size: 0.8em;
319 span.footnote, span.footnoteref {
320 vertical-align: super;
323 #footnotes {
324 margin: 20px 0 20px 0;
325 padding: 7px 0 0 0;
328 #footnotes div.footnote {
329 margin: 0 0 5px 0;
332 #footnotes hr {
333 border: none;
334 border-top: 1px solid silver;
335 height: 1px;
336 text-align: left;
337 margin-left: 0;
338 width: 20%;
339 min-width: 100px;
343 @media print {
344 div#footer-badges { display: none; }
347 div#toc {
348 margin-bottom: 2.5em;
351 div#toctitle {
352 color: #527bbd;
353 font-family: sans-serif;
354 font-size: 1.1em;
355 font-weight: bold;
356 margin-top: 1.0em;
357 margin-bottom: 0.1em;
360 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
361 margin-top: 0;
362 margin-bottom: 0;
364 div.toclevel2 {
365 margin-left: 2em;
366 font-size: 0.9em;
368 div.toclevel3 {
369 margin-left: 4em;
370 font-size: 0.9em;
372 div.toclevel4 {
373 margin-left: 6em;
374 font-size: 0.9em;
376 /* Overrides for manpage documents */
377 h1 {
378 padding-top: 0.5em;
379 padding-bottom: 0.5em;
380 border-top: 2px solid silver;
381 border-bottom: 2px solid silver;
383 h2 {
384 border-style: none;
386 div.sectionbody {
387 margin-left: 5%;
390 @media print {
391 div#toc { display: none; }
394 /* Workarounds for IE6's broken and incomplete CSS2. */
396 div.sidebar-content {
397 background: #ffffee;
398 border: 1px solid silver;
399 padding: 0.5em;
401 div.sidebar-title, div.image-title {
402 color: #527bbd;
403 font-family: sans-serif;
404 font-weight: bold;
405 margin-top: 0.0em;
406 margin-bottom: 0.5em;
409 div.listingblock div.content {
410 border: 1px solid silver;
411 background: #f4f4f4;
412 padding: 0.5em;
415 div.quoteblock-attribution {
416 padding-top: 0.5em;
417 text-align: right;
420 div.verseblock-content {
421 white-space: pre;
423 div.verseblock-attribution {
424 padding-top: 0.75em;
425 text-align: left;
428 div.exampleblock-content {
429 border-left: 3px solid #dddddd;
430 padding-left: 0.5em;
433 /* IE6 sets dynamically generated links as visited. */
434 div#toc a:visited { color: blue; }
435 </style>
436 <script type="text/javascript">
437 /*<![CDATA[*/
438 window.onload = function(){asciidoc.footnotes();}
439 var asciidoc = { // Namespace.
441 /////////////////////////////////////////////////////////////////////
442 // Table Of Contents generator
443 /////////////////////////////////////////////////////////////////////
445 /* Author: Mihai Bazon, September 2002
446 * http://students.infoiasi.ro/~mishoo
448 * Table Of Content generator
449 * Version: 0.4
451 * Feel free to use this script under the terms of the GNU General Public
452 * License, as long as you do not remove or alter this notice.
455 /* modified by Troy D. Hanson, September 2006. License: GPL */
456 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
458 // toclevels = 1..4.
459 toc: function (toclevels) {
461 function getText(el) {
462 var text = "";
463 for (var i = el.firstChild; i != null; i = i.nextSibling) {
464 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
465 text += i.data;
466 else if (i.firstChild != null)
467 text += getText(i);
469 return text;
472 function TocEntry(el, text, toclevel) {
473 this.element = el;
474 this.text = text;
475 this.toclevel = toclevel;
478 function tocEntries(el, toclevels) {
479 var result = new Array;
480 var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
481 // Function that scans the DOM tree for header elements (the DOM2
482 // nodeIterator API would be a better technique but not supported by all
483 // browsers).
484 var iterate = function (el) {
485 for (var i = el.firstChild; i != null; i = i.nextSibling) {
486 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
487 var mo = re.exec(i.tagName);
488 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
489 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
491 iterate(i);
495 iterate(el);
496 return result;
499 var toc = document.getElementById("toc");
500 var entries = tocEntries(document.getElementById("content"), toclevels);
501 for (var i = 0; i < entries.length; ++i) {
502 var entry = entries[i];
503 if (entry.element.id == "")
504 entry.element.id = "_toc_" + i;
505 var a = document.createElement("a");
506 a.href = "#" + entry.element.id;
507 a.appendChild(document.createTextNode(entry.text));
508 var div = document.createElement("div");
509 div.appendChild(a);
510 div.className = "toclevel" + entry.toclevel;
511 toc.appendChild(div);
513 if (entries.length == 0)
514 toc.parentNode.removeChild(toc);
518 /////////////////////////////////////////////////////////////////////
519 // Footnotes generator
520 /////////////////////////////////////////////////////////////////////
522 /* Based on footnote generation code from:
523 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
526 footnotes: function () {
527 var cont = document.getElementById("content");
528 var noteholder = document.getElementById("footnotes");
529 var spans = cont.getElementsByTagName("span");
530 var refs = {};
531 var n = 0;
532 for (i=0; i<spans.length; i++) {
533 if (spans[i].className == "footnote") {
534 n++;
535 // Use [\s\S] in place of . so multi-line matches work.
536 // Because JavaScript has no s (dotall) regex flag.
537 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
538 noteholder.innerHTML +=
539 "<div class='footnote' id='_footnote_" + n + "'>" +
540 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
541 n + "</a>. " + note + "</div>";
542 spans[i].innerHTML =
543 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
544 "' title='View footnote' class='footnote'>" + n + "</a>]";
545 var id =spans[i].getAttribute("id");
546 if (id != null) refs["#"+id] = n;
549 if (n == 0)
550 noteholder.parentNode.removeChild(noteholder);
551 else {
552 // Process footnoterefs.
553 for (i=0; i<spans.length; i++) {
554 if (spans[i].className == "footnoteref") {
555 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
556 href = href.match(/#.*/)[0]; // Because IE return full URL.
557 n = refs[href];
558 spans[i].innerHTML =
559 "[<a href='#_footnote_" + n +
560 "' title='View footnote' class='footnote'>" + n + "</a>]";
567 /*]]>*/
568 </script>
569 </head>
570 <body>
571 <div id="header">
572 <h1>
573 git-update-index(1) Manual Page
574 </h1>
575 <h2>NAME</h2>
576 <div class="sectionbody">
577 <p>git-update-index -
578 Register file contents in the working tree to the index
579 </p>
580 </div>
581 </div>
582 <div id="content">
583 <h2 id="_synopsis">SYNOPSIS</h2>
584 <div class="sectionbody">
585 <div class="verseblock">
586 <div class="verseblock-content"><em>git update-index</em>
587 [--add] [--remove | --force-remove] [--replace]
588 [--refresh] [-q] [--unmerged] [--ignore-missing]
589 [(--cacheinfo &lt;mode&gt; &lt;object&gt; &lt;file&gt;)&#8230;]
590 [--chmod=(+|-)x]
591 [--assume-unchanged | --no-assume-unchanged]
592 [--skip-worktree | --no-skip-worktree]
593 [--ignore-submodules]
594 [--really-refresh] [--unresolve] [--again | -g]
595 [--info-only] [--index-info]
596 [-z] [--stdin]
597 [--verbose]
598 [--] [&lt;file&gt;&#8230;]</div>
599 <div class="verseblock-attribution">
600 </div></div>
601 </div>
602 <h2 id="_description">DESCRIPTION</h2>
603 <div class="sectionbody">
604 <div class="paragraph"><p>Modifies the index or directory cache. Each file mentioned is updated
605 into the index and any <em>unmerged</em> or <em>needs updating</em> state is
606 cleared.</p></div>
607 <div class="paragraph"><p>See also <a href="git-add.html">git-add(1)</a> for a more user-friendly way to do some of
608 the most common operations on the index.</p></div>
609 <div class="paragraph"><p>The way <em>git update-index</em> handles files it is told about can be modified
610 using the various options:</p></div>
611 </div>
612 <h2 id="_options">OPTIONS</h2>
613 <div class="sectionbody">
614 <div class="dlist"><dl>
615 <dt class="hdlist1">
616 --add
617 </dt>
618 <dd>
620 If a specified file isn&#8217;t in the index already then it&#8217;s
621 added.
622 Default behaviour is to ignore new files.
623 </p>
624 </dd>
625 <dt class="hdlist1">
626 --remove
627 </dt>
628 <dd>
630 If a specified file is in the index but is missing then it&#8217;s
631 removed.
632 Default behavior is to ignore removed file.
633 </p>
634 </dd>
635 <dt class="hdlist1">
636 --refresh
637 </dt>
638 <dd>
640 Looks at the current index and checks to see if merges or
641 updates are needed by checking stat() information.
642 </p>
643 </dd>
644 <dt class="hdlist1">
646 </dt>
647 <dd>
649 Quiet. If --refresh finds that the index needs an update, the
650 default behavior is to error out. This option makes
651 <em>git update-index</em> continue anyway.
652 </p>
653 </dd>
654 <dt class="hdlist1">
655 --ignore-submodules
656 </dt>
657 <dd>
659 Do not try to update submodules. This option is only respected
660 when passed before --refresh.
661 </p>
662 </dd>
663 <dt class="hdlist1">
664 --unmerged
665 </dt>
666 <dd>
668 If --refresh finds unmerged changes in the index, the default
669 behavior is to error out. This option makes <em>git update-index</em>
670 continue anyway.
671 </p>
672 </dd>
673 <dt class="hdlist1">
674 --ignore-missing
675 </dt>
676 <dd>
678 Ignores missing files during a --refresh
679 </p>
680 </dd>
681 <dt class="hdlist1">
682 --cacheinfo &lt;mode&gt; &lt;object&gt; &lt;path&gt;
683 </dt>
684 <dd>
686 Directly insert the specified info into the index.
687 </p>
688 </dd>
689 <dt class="hdlist1">
690 --index-info
691 </dt>
692 <dd>
694 Read index information from stdin.
695 </p>
696 </dd>
697 <dt class="hdlist1">
698 --chmod=(+|-)x
699 </dt>
700 <dd>
702 Set the execute permissions on the updated files.
703 </p>
704 </dd>
705 <dt class="hdlist1">
706 --assume-unchanged
707 </dt>
708 <dt class="hdlist1">
709 --no-assume-unchanged
710 </dt>
711 <dd>
713 When these flags are specified, the object names recorded
714 for the paths are not updated. Instead, these options
715 set and unset the "assume unchanged" bit for the
716 paths. When the "assume unchanged" bit is on, git stops
717 checking the working tree files for possible
718 modifications, so you need to manually unset the bit to
719 tell git when you change the working tree file. This is
720 sometimes helpful when working with a big project on a
721 filesystem that has very slow lstat(2) system call
722 (e.g. cifs).
723 </p>
724 <div class="paragraph"><p>This option can be also used as a coarse file-level mechanism
725 to ignore uncommitted changes in tracked files (akin to what
726 <tt>.gitignore</tt> does for untracked files).
727 Git will fail (gracefully) in case it needs to modify this file
728 in the index e.g. when merging in a commit;
729 thus, in case the assumed-untracked file is changed upstream,
730 you will need to handle the situation manually.</p></div>
731 </dd>
732 <dt class="hdlist1">
733 --really-refresh
734 </dt>
735 <dd>
737 Like <em>--refresh</em>, but checks stat information unconditionally,
738 without regard to the "assume unchanged" setting.
739 </p>
740 </dd>
741 <dt class="hdlist1">
742 --skip-worktree
743 </dt>
744 <dt class="hdlist1">
745 --no-skip-worktree
746 </dt>
747 <dd>
749 When one of these flags is specified, the object name recorded
750 for the paths are not updated. Instead, these options
751 set and unset the "skip-worktree" bit for the paths. See
752 section "Skip-worktree bit" below for more information.
753 </p>
754 </dd>
755 <dt class="hdlist1">
757 </dt>
758 <dt class="hdlist1">
759 --again
760 </dt>
761 <dd>
763 Runs <em>git update-index</em> itself on the paths whose index
764 entries are different from those from the <tt>HEAD</tt> commit.
765 </p>
766 </dd>
767 <dt class="hdlist1">
768 --unresolve
769 </dt>
770 <dd>
772 Restores the <em>unmerged</em> or <em>needs updating</em> state of a
773 file during a merge if it was cleared by accident.
774 </p>
775 </dd>
776 <dt class="hdlist1">
777 --info-only
778 </dt>
779 <dd>
781 Do not create objects in the object database for all
782 &lt;file&gt; arguments that follow this flag; just insert
783 their object IDs into the index.
784 </p>
785 </dd>
786 <dt class="hdlist1">
787 --force-remove
788 </dt>
789 <dd>
791 Remove the file from the index even when the working directory
792 still has such a file. (Implies --remove.)
793 </p>
794 </dd>
795 <dt class="hdlist1">
796 --replace
797 </dt>
798 <dd>
800 By default, when a file <tt>path</tt> exists in the index,
801 <em>git update-index</em> refuses an attempt to add <tt>path/file</tt>.
802 Similarly if a file <tt>path/file</tt> exists, a file <tt>path</tt>
803 cannot be added. With --replace flag, existing entries
804 that conflict with the entry being added are
805 automatically removed with warning messages.
806 </p>
807 </dd>
808 <dt class="hdlist1">
809 --stdin
810 </dt>
811 <dd>
813 Instead of taking list of paths from the command line,
814 read list of paths from the standard input. Paths are
815 separated by LF (i.e. one path per line) by default.
816 </p>
817 </dd>
818 <dt class="hdlist1">
819 --verbose
820 </dt>
821 <dd>
823 Report what is being added and removed from index.
824 </p>
825 </dd>
826 <dt class="hdlist1">
828 </dt>
829 <dd>
831 Only meaningful with <tt>--stdin</tt> or <tt>--index-info</tt>; paths are
832 separated with NUL character instead of LF.
833 </p>
834 </dd>
835 <dt class="hdlist1">
837 </dt>
838 <dd>
840 Do not interpret any more arguments as options.
841 </p>
842 </dd>
843 <dt class="hdlist1">
844 &lt;file&gt;
845 </dt>
846 <dd>
848 Files to act on.
849 Note that files beginning with <em>.</em> are discarded. This includes
850 <tt>./file</tt> and <tt>dir/./file</tt>. If you don&#8217;t want this, then use
851 cleaner names.
852 The same applies to directories ending <em>/</em> and paths with <em>//</em>
853 </p>
854 </dd>
855 </dl></div>
856 </div>
857 <h2 id="_using_refresh">Using --refresh</h2>
858 <div class="sectionbody">
859 <div class="paragraph"><p><em>--refresh</em> does not calculate a new sha1 file or bring the index
860 up-to-date for mode/content changes. But what it <strong>does</strong> do is to
861 "re-match" the stat information of a file with the index, so that you
862 can refresh the index for a file that hasn&#8217;t been changed but where
863 the stat entry is out of date.</p></div>
864 <div class="paragraph"><p>For example, you&#8217;d want to do this after doing a <em>git read-tree</em>, to link
865 up the stat index details with the proper files.</p></div>
866 </div>
867 <h2 id="_using_cacheinfo_or_info_only">Using --cacheinfo or --info-only</h2>
868 <div class="sectionbody">
869 <div class="paragraph"><p><em>--cacheinfo</em> is used to register a file that is not in the
870 current working directory. This is useful for minimum-checkout
871 merging.</p></div>
872 <div class="paragraph"><p>To pretend you have a file with mode and sha1 at path, say:</p></div>
873 <div class="listingblock">
874 <div class="content">
875 <pre><tt>$ git update-index --cacheinfo mode sha1 path</tt></pre>
876 </div></div>
877 <div class="paragraph"><p><em>--info-only</em> is used to register files without placing them in the object
878 database. This is useful for status-only repositories.</p></div>
879 <div class="paragraph"><p>Both <em>--cacheinfo</em> and <em>--info-only</em> behave similarly: the index is updated
880 but the object database isn&#8217;t. <em>--cacheinfo</em> is useful when the object is
881 in the database but the file isn&#8217;t available locally. <em>--info-only</em> is
882 useful when the file is available, but you do not wish to update the
883 object database.</p></div>
884 </div>
885 <h2 id="_using_index_info">Using --index-info</h2>
886 <div class="sectionbody">
887 <div class="paragraph"><p><tt>--index-info</tt> is a more powerful mechanism that lets you feed
888 multiple entry definitions from the standard input, and designed
889 specifically for scripts. It can take inputs of three formats:</p></div>
890 <div class="olist arabic"><ol class="arabic">
891 <li>
893 mode SP sha1 TAB path
894 </p>
895 <div class="paragraph"><p>The first format is what "git-apply --index-info"
896 reports, and used to reconstruct a partial tree
897 that is used for phony merge base tree when falling
898 back on 3-way merge.</p></div>
899 </li>
900 <li>
902 mode SP type SP sha1 TAB path
903 </p>
904 <div class="paragraph"><p>The second format is to stuff <em>git ls-tree</em> output
905 into the index file.</p></div>
906 </li>
907 <li>
909 mode SP sha1 SP stage TAB path
910 </p>
911 <div class="paragraph"><p>This format is to put higher order stages into the
912 index file and matches <em>git ls-files --stage</em> output.</p></div>
913 </li>
914 </ol></div>
915 <div class="paragraph"><p>To place a higher stage entry to the index, the path should
916 first be removed by feeding a mode=0 entry for the path, and
917 then feeding necessary input lines in the third format.</p></div>
918 <div class="paragraph"><p>For example, starting with this index:</p></div>
919 <div class="listingblock">
920 <div class="content">
921 <pre><tt>$ git ls-files -s
922 100644 8a1218a1024a212bb3db30becd860315f9f3ac52 0 frotz</tt></pre>
923 </div></div>
924 <div class="paragraph"><p>you can feed the following input to <tt>--index-info</tt>:</p></div>
925 <div class="listingblock">
926 <div class="content">
927 <pre><tt>$ git update-index --index-info
928 0 0000000000000000000000000000000000000000 frotz
929 100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1 frotz
930 100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2 frotz</tt></pre>
931 </div></div>
932 <div class="paragraph"><p>The first line of the input feeds 0 as the mode to remove the
933 path; the SHA1 does not matter as long as it is well formatted.
934 Then the second and third line feeds stage 1 and stage 2 entries
935 for that path. After the above, we would end up with this:</p></div>
936 <div class="listingblock">
937 <div class="content">
938 <pre><tt>$ git ls-files -s
939 100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1 frotz
940 100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2 frotz</tt></pre>
941 </div></div>
942 </div>
943 <h2 id="_using_8220_assume_unchanged_8221_bit">Using &#8220;assume unchanged&#8221; bit</h2>
944 <div class="sectionbody">
945 <div class="paragraph"><p>Many operations in git depend on your filesystem to have an
946 efficient <tt>lstat(2)</tt> implementation, so that <tt>st_mtime</tt>
947 information for working tree files can be cheaply checked to see
948 if the file contents have changed from the version recorded in
949 the index file. Unfortunately, some filesystems have
950 inefficient <tt>lstat(2)</tt>. If your filesystem is one of them, you
951 can set "assume unchanged" bit to paths you have not changed to
952 cause git not to do this check. Note that setting this bit on a
953 path does not mean git will check the contents of the file to
954 see if it has changed&#8201;&#8212;&#8201;it makes git to omit any checking and
955 assume it has <strong>not</strong> changed. When you make changes to working
956 tree files, you have to explicitly tell git about it by dropping
957 "assume unchanged" bit, either before or after you modify them.</p></div>
958 <div class="paragraph"><p>In order to set "assume unchanged" bit, use <tt>--assume-unchanged</tt>
959 option. To unset, use <tt>--no-assume-unchanged</tt>. To see which files
960 have the "assume unchanged" bit set, use <tt>git ls-files -v</tt>
961 (see <a href="git-ls-files.html">git-ls-files(1)</a>).</p></div>
962 <div class="paragraph"><p>The command looks at <tt>core.ignorestat</tt> configuration variable. When
963 this is true, paths updated with <tt>git update-index paths&#8230;</tt> and
964 paths updated with other git commands that update both index and
965 working tree (e.g. <em>git apply --index</em>, <em>git checkout-index -u</em>,
966 and <em>git read-tree -u</em>) are automatically marked as "assume
967 unchanged". Note that "assume unchanged" bit is <strong>not</strong> set if
968 <tt>git update-index --refresh</tt> finds the working tree file matches
969 the index (use <tt>git update-index --really-refresh</tt> if you want
970 to mark them as "assume unchanged").</p></div>
971 </div>
972 <h2 id="_examples">Examples</h2>
973 <div class="sectionbody">
974 <div class="paragraph"><p>To update and refresh only the files already checked out:</p></div>
975 <div class="listingblock">
976 <div class="content">
977 <pre><tt>$ git checkout-index -n -f -a &amp;&amp; git update-index --ignore-missing --refresh</tt></pre>
978 </div></div>
979 <div class="dlist"><dl>
980 <dt class="hdlist1">
981 On an inefficient filesystem with <tt>core.ignorestat</tt> set
982 </dt>
983 <dd>
984 <div class="listingblock">
985 <div class="content">
986 <pre><tt>$ git update-index --really-refresh <b>&lt;1&gt;</b>
987 $ git update-index --no-assume-unchanged foo.c <b>&lt;2&gt;</b>
988 $ git diff --name-only <b>&lt;3&gt;</b>
989 $ edit foo.c
990 $ git diff --name-only <b>&lt;4&gt;</b>
991 M foo.c
992 $ git update-index foo.c <b>&lt;5&gt;</b>
993 $ git diff --name-only <b>&lt;6&gt;</b>
994 $ edit foo.c
995 $ git diff --name-only <b>&lt;7&gt;</b>
996 $ git update-index --no-assume-unchanged foo.c <b>&lt;8&gt;</b>
997 $ git diff --name-only <b>&lt;9&gt;</b>
998 M foo.c</tt></pre>
999 </div></div>
1000 <div class="colist arabic"><ol>
1001 <li>
1003 forces lstat(2) to set "assume unchanged" bits for paths that match index.
1004 </p>
1005 </li>
1006 <li>
1008 mark the path to be edited.
1009 </p>
1010 </li>
1011 <li>
1013 this does lstat(2) and finds index matches the path.
1014 </p>
1015 </li>
1016 <li>
1018 this does lstat(2) and finds index does <strong>not</strong> match the path.
1019 </p>
1020 </li>
1021 <li>
1023 registering the new version to index sets "assume unchanged" bit.
1024 </p>
1025 </li>
1026 <li>
1028 and it is assumed unchanged.
1029 </p>
1030 </li>
1031 <li>
1033 even after you edit it.
1034 </p>
1035 </li>
1036 <li>
1038 you can tell about the change after the fact.
1039 </p>
1040 </li>
1041 <li>
1043 now it checks with lstat(2) and finds it has been changed.
1044 </p>
1045 </li>
1046 </ol></div>
1047 </dd>
1048 </dl></div>
1049 </div>
1050 <h2 id="_skip_worktree_bit">Skip-worktree bit</h2>
1051 <div class="sectionbody">
1052 <div class="paragraph"><p>Skip-worktree bit can be defined in one (long) sentence: When reading
1053 an entry, if it is marked as skip-worktree, then Git pretends its
1054 working directory version is up to date and read the index version
1055 instead.</p></div>
1056 <div class="paragraph"><p>To elaborate, "reading" means checking for file existence, reading
1057 file attributes or file content. The working directory version may be
1058 present or absent. If present, its content may match against the index
1059 version or not. Writing is not affected by this bit, content safety
1060 is still first priority. Note that Git <em>can</em> update working directory
1061 file, that is marked skip-worktree, if it is safe to do so (i.e.
1062 working directory version matches index version)</p></div>
1063 <div class="paragraph"><p>Although this bit looks similar to assume-unchanged bit, its goal is
1064 different from assume-unchanged bit&#8217;s. Skip-worktree also takes
1065 precedence over assume-unchanged bit when both are set.</p></div>
1066 </div>
1067 <h2 id="_configuration">Configuration</h2>
1068 <div class="sectionbody">
1069 <div class="paragraph"><p>The command honors <tt>core.filemode</tt> configuration variable. If
1070 your repository is on a filesystem whose executable bits are
1071 unreliable, this should be set to <em>false</em> (see <a href="git-config.html">git-config(1)</a>).
1072 This causes the command to ignore differences in file modes recorded
1073 in the index and the file mode on the filesystem if they differ only on
1074 executable bit. On such an unfortunate filesystem, you may
1075 need to use <em>git update-index --chmod=</em>.</p></div>
1076 <div class="paragraph"><p>Quite similarly, if <tt>core.symlinks</tt> configuration variable is set
1077 to <em>false</em> (see <a href="git-config.html">git-config(1)</a>), symbolic links are checked out
1078 as plain files, and this command does not modify a recorded file mode
1079 from symbolic link to regular file.</p></div>
1080 <div class="paragraph"><p>The command looks at <tt>core.ignorestat</tt> configuration variable. See
1081 <em>Using "assume unchanged" bit</em> section above.</p></div>
1082 <div class="paragraph"><p>The command also looks at <tt>core.trustctime</tt> configuration variable.
1083 It can be useful when the inode change time is regularly modified by
1084 something outside Git (file system crawlers and backup systems use
1085 ctime for marking files processed) (see <a href="git-config.html">git-config(1)</a>).</p></div>
1086 </div>
1087 <h2 id="_see_also">SEE ALSO</h2>
1088 <div class="sectionbody">
1089 <div class="paragraph"><p><a href="git-config.html">git-config(1)</a>,
1090 <a href="git-add.html">git-add(1)</a>,
1091 <a href="git-ls-files.html">git-ls-files(1)</a></p></div>
1092 </div>
1093 <h2 id="_git">GIT</h2>
1094 <div class="sectionbody">
1095 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1096 </div>
1097 </div>
1098 <div id="footnotes"><hr /></div>
1099 <div id="footer">
1100 <div id="footer-text">
1101 Last updated 2011-10-05 13:59:16 PDT
1102 </div>
1103 </div>
1104 </body>
1105 </html>