1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
6 <meta http-equiv=
"Content-Type" content=
"application/xhtml+xml; charset=UTF-8" />
7 <meta name=
"generator" content=
"AsciiDoc 10.2.0" />
8 <title>git-update-index(
1)
</title>
9 <style type=
"text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
14 font-family: Georgia,serif;
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
22 #author, #revnumber, #revdate, #revremark,
24 font-family: Arial,Helvetica,sans-serif;
28 margin:
1em
5%
1em
5%;
33 text-decoration: underline;
49 h1, h2, h3, h4, h5, h6 {
57 border-bottom:
2px solid silver;
77 border:
1px solid silver;
88 ul
> li { color: #aaa; }
89 ul
> li
> * { color: black; }
91 .monospaced, code, pre {
92 font-family:
"Courier New", Courier, monospace;
99 white-space: pre-wrap;
109 #revnumber, #revdate, #revremark {
114 border-top:
2px solid silver;
120 padding-bottom:
0.5em;
124 padding-bottom:
0.5em;
129 margin-bottom:
1.5em;
131 div.imageblock, div.exampleblock, div.verseblock,
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133 div.admonitionblock {
135 margin-bottom:
1.5em;
137 div.admonitionblock {
139 margin-bottom:
2.0em;
144 div.content { /* Block element content. */
148 /* Block element titles. */
149 div.title, caption.title {
154 margin-bottom:
0.5em;
160 td div.title:first-child {
163 div.content div.title:first-child {
166 div.content + div.title {
170 div.sidebarblock
> div.content {
172 border:
1px solid #dddddd;
173 border-left:
4px solid #f0f0f0;
177 div.listingblock
> div.content {
178 border:
1px solid #dddddd;
179 border-left:
5px solid #f0f0f0;
184 div.quoteblock, div.verseblock {
188 border-left:
5px solid #f0f0f0;
192 div.quoteblock
> div.attribution {
197 div.verseblock
> pre.content {
198 font-family: inherit;
201 div.verseblock
> div.attribution {
205 /* DEPRECATED: Pre version
8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
210 div.admonitionblock .icon {
214 text-decoration: underline;
216 padding-right:
0.5em;
218 div.admonitionblock td.content {
220 border-left:
3px solid #dddddd;
223 div.exampleblock
> div.content {
224 border-left:
3px solid #dddddd;
228 div.imageblock div.content { padding-left:
0; }
229 span.image img { border-style: none; vertical-align: text-bottom; }
230 a.image:visited { color: white; }
234 margin-bottom:
0.8em;
247 list-style-position: outside;
250 list-style-type: decimal;
253 list-style-type: lower-alpha;
256 list-style-type: upper-alpha;
259 list-style-type: lower-roman;
262 list-style-type: upper-roman;
265 div.compact ul, div.compact ol,
266 div.compact p, div.compact p,
267 div.compact div, div.compact div {
269 margin-bottom:
0.1em;
281 margin-bottom:
0.8em;
284 padding-bottom:
15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
292 padding-right:
0.8em;
298 div.hdlist.compact tr {
307 .footnote, .footnoteref {
311 span.footnote, span.footnoteref {
312 vertical-align: super;
316 margin:
20px
0 20px
0;
320 #footnotes div.footnote {
326 border-top:
1px solid silver;
335 padding-right:
0.5em;
336 padding-bottom:
0.3em;
344 #footer-badges { display: none; }
348 margin-bottom:
2.5em;
356 margin-bottom:
0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
376 span.aqua { color: aqua; }
377 span.black { color: black; }
378 span.blue { color: blue; }
379 span.fuchsia { color: fuchsia; }
380 span.gray { color: gray; }
381 span.green { color: green; }
382 span.lime { color: lime; }
383 span.maroon { color: maroon; }
384 span.navy { color: navy; }
385 span.olive { color: olive; }
386 span.purple { color: purple; }
387 span.red { color: red; }
388 span.silver { color: silver; }
389 span.teal { color: teal; }
390 span.white { color: white; }
391 span.yellow { color: yellow; }
393 span.aqua-background { background: aqua; }
394 span.black-background { background: black; }
395 span.blue-background { background: blue; }
396 span.fuchsia-background { background: fuchsia; }
397 span.gray-background { background: gray; }
398 span.green-background { background: green; }
399 span.lime-background { background: lime; }
400 span.maroon-background { background: maroon; }
401 span.navy-background { background: navy; }
402 span.olive-background { background: olive; }
403 span.purple-background { background: purple; }
404 span.red-background { background: red; }
405 span.silver-background { background: silver; }
406 span.teal-background { background: teal; }
407 span.white-background { background: white; }
408 span.yellow-background { background: yellow; }
410 span.big { font-size:
2em; }
411 span.small { font-size:
0.6em; }
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
417 div.unbreakable { page-break-inside: avoid; }
427 margin-bottom:
1.5em;
429 div.tableblock
> table {
430 border:
3px solid #
527bbd;
432 thead, p.table.header {
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock
> table[
frame=
"void"] {
443 div.tableblock
> table[
frame=
"hsides"] {
444 border-left-style: none;
445 border-right-style: none;
447 div.tableblock
> table[
frame=
"vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
460 margin-bottom:
1.5em;
462 thead, p.tableblock.header {
473 border-color: #
527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
480 border-color: #
527bbd;
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
491 table.tableblock.frame-none {
492 border-style: hidden;
495 th.tableblock.halign-left, td.tableblock.halign-left {
498 th.tableblock.halign-center, td.tableblock.halign-center {
501 th.tableblock.halign-right, td.tableblock.halign-right {
505 th.tableblock.valign-top, td.tableblock.valign-top {
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
523 padding-bottom:
0.5em;
524 border-top:
2px solid silver;
525 border-bottom:
2px solid silver;
530 body.manpage div.sectionbody {
535 body.manpage div#toc { display: none; }
540 <script type=
"text/javascript">
542 var asciidoc = { // Namespace.
544 /////////////////////////////////////////////////////////////////////
545 // Table Of Contents generator
546 /////////////////////////////////////////////////////////////////////
548 /* Author: Mihai Bazon, September
2002
549 * http://students.infoiasi.ro/~mishoo
551 * Table Of Content generator
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
558 /* modified by Troy D. Hanson, September
2006. License: GPL */
559 /* modified by Stuart Rackham,
2006,
2009. License: GPL */
562 toc: function (toclevels) {
564 function getText(el) {
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType ==
3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
569 else if (i.firstChild != null)
575 function TocEntry(el, text, toclevel) {
578 this.toclevel = toclevel;
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([
1-'+(toclevels+
1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType ==
1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute(
"class") || i.getAttribute(
"className")) !=
"float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[
1]-
1);
602 var toc = document.getElementById(
"toc");
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
610 for (i =
0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute(
"class")
614 && entry.getAttribute(
"class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
617 for (i =
0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById(
"content"), toclevels);
623 for (var i =
0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id ==
"")
626 entry.element.id =
"_toc_" + i;
627 var a = document.createElement(
"a");
628 a.href =
"#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement(
"div");
632 div.className =
"toclevel" + entry.toclevel;
633 toc.appendChild(div);
635 if (entries.length ==
0)
636 toc.parentNode.removeChild(toc);
640 /////////////////////////////////////////////////////////////////////
641 // Footnotes generator
642 /////////////////////////////////////////////////////////////////////
644 /* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/
2005/
07/format_footnote.html
648 footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
651 var noteholder = document.getElementById(
"footnotes");
655 var entriesToRemove = [];
656 for (i =
0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute(
"class") ==
"footnote")
659 entriesToRemove.push(entry);
661 for (i =
0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
665 // Rebuild footnote entries.
666 var cont = document.getElementById(
"content");
667 var spans = cont.getElementsByTagName(
"span");
670 for (i=
0; i
<spans.length; i++) {
671 if (spans[i].className ==
"footnote") {
673 var note = spans[i].getAttribute(
"data-note");
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[
1];
679 "[<a id='_footnoteref_" + n +
"' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n +
"</a>]";
681 spans[i].setAttribute(
"data-note", note);
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n +
"'>" +
685 "<a href='#_footnoteref_" + n +
"' title='Return to text'>" +
686 n +
"</a>. " + note +
"</div>";
687 var id =spans[i].getAttribute(
"id");
688 if (id != null) refs[
"#"+id] = n;
692 noteholder.parentNode.removeChild(noteholder);
694 // Process footnoterefs.
695 for (i=
0; i
<spans.length; i++) {
696 if (spans[i].className ==
"footnoteref") {
697 var href = spans[i].getElementsByTagName(
"a")[
0].getAttribute(
"href");
698 href = href.match(/#.*/)[
0]; // Because IE return full URL.
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n +
"</a>]";
708 install: function(toclevels) {
711 function reinstall() {
712 asciidoc.footnotes();
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
723 timerId = setInterval(reinstall,
500);
724 if (document.addEventListener)
725 document.addEventListener(
"DOMContentLoaded", reinstallAndRemoveTimer, false);
727 window.onload = reinstallAndRemoveTimer;
735 <body class=
"manpage">
738 git-update-index(
1) Manual Page
741 <div class=
"sectionbody">
742 <p>git-update-index -
743 Register file contents in the working tree to the index
749 <h2 id=
"_synopsis">SYNOPSIS
</h2>
750 <div class=
"sectionbody">
751 <div class=
"verseblock">
752 <pre class=
"content"><em>git update-index
</em>
753 [--add] [--remove | --force-remove] [--replace]
754 [--refresh] [-q] [--unmerged] [--ignore-missing]
755 [(--cacheinfo
<mode
>,
<object
>,
<file
>)
…]
757 [--[no-]assume-unchanged]
758 [--[no-]skip-worktree]
759 [--[no-]ignore-skip-worktree-entries]
760 [--[no-]fsmonitor-valid]
761 [--ignore-submodules]
763 [--[no-|test-|force-]untracked-cache]
765 [--really-refresh] [--unresolve] [--again | -g]
766 [--info-only] [--index-info]
767 [-z] [--stdin] [--index-version
<n
>]
769 [--] [
<file
>…]
</pre>
770 <div class=
"attribution">
775 <h2 id=
"_description">DESCRIPTION
</h2>
776 <div class=
"sectionbody">
777 <div class=
"paragraph"><p>Modifies the index. Each file mentioned is updated into the index and
778 any
<em>unmerged
</em> or
<em>needs updating
</em> state is cleared.
</p></div>
779 <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
780 the most common operations on the index.
</p></div>
781 <div class=
"paragraph"><p>The way
<em>git update-index
</em> handles files it is told about can be modified
782 using the various options:
</p></div>
786 <h2 id=
"_options">OPTIONS
</h2>
787 <div class=
"sectionbody">
788 <div class=
"dlist"><dl>
794 If a specified file isn
’t in the index already then it
’s
796 Default behaviour is to ignore new files.
804 If a specified file is in the index but is missing then it
’s
806 Default behavior is to ignore removed file.
814 Looks at the current index and checks to see if merges or
815 updates are needed by checking stat() information.
823 Quiet. If --refresh finds that the index needs an update, the
824 default behavior is to error out. This option makes
825 <em>git update-index
</em> continue anyway.
833 Do not try to update submodules. This option is only respected
834 when passed before --refresh.
842 If --refresh finds unmerged changes in the index, the default
843 behavior is to error out. This option makes
<em>git update-index
</em>
852 Ignores missing files during a --refresh
856 --cacheinfo
<mode
>,
<object
>,
<path
>
859 --cacheinfo
<mode
> <object
> <path
>
863 Directly insert the specified info into the index. For
864 backward compatibility, you can also give these three
865 arguments as three separate parameters, but new users are
866 encouraged to use a single-parameter form.
874 Read index information from stdin.
882 Set the execute permissions on the updated files.
886 --[no-]assume-unchanged
890 When this flag is specified, the object names recorded
891 for the paths are not updated. Instead, this option
892 sets/unsets the
"assume unchanged" bit for the
893 paths. When the
"assume unchanged" bit is on, the user
894 promises not to change the file and allows Git to assume
895 that the working tree file matches what is recorded in
896 the index. If you want to change the working tree file,
897 you need to unset the bit to tell Git. This is
898 sometimes helpful when working with a big project on a
899 filesystem that has very slow lstat(
2) system call
902 <div class=
"paragraph"><p>Git will fail (gracefully) in case it needs to modify this file
903 in the index e.g. when merging in a commit;
904 thus, in case the assumed-untracked file is changed upstream,
905 you will need to handle the situation manually.
</p></div>
912 Like
<code>--refresh
</code>, but checks stat information unconditionally,
913 without regard to the
"assume unchanged" setting.
921 When one of these flags is specified, the object name recorded
922 for the paths are not updated. Instead, these options
923 set and unset the
"skip-worktree" bit for the paths. See
924 section
"Skip-worktree bit" below for more information.
928 --[no-]ignore-skip-worktree-entries
932 Do not remove skip-worktree (AKA
"index-only") entries even when
933 the
<code>--remove
</code> option was specified.
937 --[no-]fsmonitor-valid
941 When one of these flags is specified, the object name recorded
942 for the paths are not updated. Instead, these options
943 set and unset the
"fsmonitor valid" bit for the paths. See
944 section
"File System Monitor" below for more information.
955 Runs
<em>git update-index
</em> itself on the paths whose index
956 entries are different from those from the
<code>HEAD
</code> commit.
964 Restores the
<em>unmerged
</em> or
<em>needs updating
</em> state of a
965 file during a merge if it was cleared by accident.
973 Do not create objects in the object database for all
974 <file
> arguments that follow this flag; just insert
975 their object IDs into the index.
983 Remove the file from the index even when the working directory
984 still has such a file. (Implies --remove.)
992 By default, when a file
<code>path
</code> exists in the index,
993 <em>git update-index
</em> refuses an attempt to add
<code>path/file
</code>.
994 Similarly if a file
<code>path/file
</code> exists, a file
<code>path
</code>
995 cannot be added. With --replace flag, existing entries
996 that conflict with the entry being added are
997 automatically removed with warning messages.
1000 <dt class=
"hdlist1">
1005 Instead of taking list of paths from the command line,
1006 read list of paths from the standard input. Paths are
1007 separated by LF (i.e. one path per line) by default.
1010 <dt class=
"hdlist1">
1015 Report what is being added and removed from index.
1018 <dt class=
"hdlist1">
1019 --index-version
<n
>
1023 Write the resulting index out in the named on-disk format version.
1024 Supported versions are
2,
3 and
4. The current default version is
2
1025 or
3, depending on whether extra features are used, such as
1026 <code>git add -N
</code>.
1028 <div class=
"paragraph"><p>Version
4 performs a simple pathname compression that reduces index
1029 size by
30%-
50% on large repositories, which results in faster load
1030 time. Version
4 is relatively young (first released in
1.8.0 in
1031 October
2012). Other Git implementations such as JGit and libgit2
1032 may not support it yet.
</p></div>
1034 <dt class=
"hdlist1">
1039 Only meaningful with
<code>--stdin
</code> or
<code>--index-info
</code>; paths are
1040 separated with NUL character instead of LF.
1043 <dt class=
"hdlist1">
1046 <dt class=
"hdlist1">
1051 Enable or disable split index mode. If split-index mode is
1052 already enabled and
<code>--split-index
</code> is given again, all
1053 changes in $GIT_DIR/index are pushed back to the shared index
1056 <div class=
"paragraph"><p>These options take effect whatever the value of the
<code>core.splitIndex
</code>
1057 configuration variable (see
<a href=
"git-config.html">git-config(
1)
</a>). But a warning is
1058 emitted when the change goes against the configured value, as the
1059 configured value will take effect next time the index is read and this
1060 will remove the intended effect of the option.
</p></div>
1062 <dt class=
"hdlist1">
1065 <dt class=
"hdlist1">
1066 --no-untracked-cache
1070 Enable or disable untracked cache feature. Please use
1071 <code>--test-untracked-cache
</code> before enabling it.
1073 <div class=
"paragraph"><p>These options take effect whatever the value of the
<code>core.untrackedCache
</code>
1074 configuration variable (see
<a href=
"git-config.html">git-config(
1)
</a>). But a warning is
1075 emitted when the change goes against the configured value, as the
1076 configured value will take effect next time the index is read and this
1077 will remove the intended effect of the option.
</p></div>
1079 <dt class=
"hdlist1">
1080 --test-untracked-cache
1084 Only perform tests on the working directory to make sure
1085 untracked cache can be used. You have to manually enable
1086 untracked cache using
<code>--untracked-cache
</code> or
1087 <code>--force-untracked-cache
</code> or the
<code>core.untrackedCache
</code>
1088 configuration variable afterwards if you really want to use
1089 it. If a test fails the exit code is
1 and a message
1090 explains what is not working as needed, otherwise the exit
1091 code is
0 and OK is printed.
1094 <dt class=
"hdlist1">
1095 --force-untracked-cache
1099 Same as
<code>--untracked-cache
</code>. Provided for backwards
1100 compatibility with older versions of Git where
1101 <code>--untracked-cache
</code> used to imply
<code>--test-untracked-cache
</code> but
1102 this option would enable the extension unconditionally.
1105 <dt class=
"hdlist1">
1108 <dt class=
"hdlist1">
1113 Enable or disable files system monitor feature. These options
1114 take effect whatever the value of the
<code>core.fsmonitor
</code>
1115 configuration variable (see
<a href=
"git-config.html">git-config(
1)
</a>). But a warning
1116 is emitted when the change goes against the configured value, as
1117 the configured value will take effect next time the index is
1118 read and this will remove the intended effect of the option.
1121 <dt class=
"hdlist1">
1126 Do not interpret any more arguments as options.
1129 <dt class=
"hdlist1">
1135 Note that files beginning with
<em>.
</em> are discarded. This includes
1136 <code>./file
</code> and
<code>dir/./file
</code>. If you don
’t want this, then use
1138 The same applies to directories ending
<em>/
</em> and paths with
<em>//
</em>
1145 <h2 id=
"_using_refresh">USING --REFRESH
</h2>
1146 <div class=
"sectionbody">
1147 <div class=
"paragraph"><p><code>--refresh
</code> does not calculate a new sha1 file or bring the index
1148 up to date for mode/content changes. But what it
<strong>does
</strong> do is to
1149 "re-match" the stat information of a file with the index, so that you
1150 can refresh the index for a file that hasn
’t been changed but where
1151 the stat entry is out of date.
</p></div>
1152 <div class=
"paragraph"><p>For example, you
’d want to do this after doing a
<em>git read-tree
</em>, to link
1153 up the stat index details with the proper files.
</p></div>
1157 <h2 id=
"_using_cacheinfo_or_info_only">USING --CACHEINFO OR --INFO-ONLY
</h2>
1158 <div class=
"sectionbody">
1159 <div class=
"paragraph"><p><code>--cacheinfo
</code> is used to register a file that is not in the
1160 current working directory. This is useful for minimum-checkout
1162 <div class=
"paragraph"><p>To pretend you have a file at path with mode and sha1, say:
</p></div>
1163 <div class=
"listingblock">
1164 <div class=
"content">
1165 <pre><code>$ git update-index --add --cacheinfo
<mode
>,
<sha1
>,
<path
></code></pre>
1167 <div class=
"paragraph"><p><code>--info-only
</code> is used to register files without placing them in the object
1168 database. This is useful for status-only repositories.
</p></div>
1169 <div class=
"paragraph"><p>Both
<code>--cacheinfo
</code> and
<code>--info-only
</code> behave similarly: the index is updated
1170 but the object database isn
’t.
<code>--cacheinfo
</code> is useful when the object is
1171 in the database but the file isn
’t available locally.
<code>--info-only
</code> is
1172 useful when the file is available, but you do not wish to update the
1173 object database.
</p></div>
1177 <h2 id=
"_using_index_info">USING --INDEX-INFO
</h2>
1178 <div class=
"sectionbody">
1179 <div class=
"paragraph"><p><code>--index-info
</code> is a more powerful mechanism that lets you feed
1180 multiple entry definitions from the standard input, and designed
1181 specifically for scripts. It can take inputs of three formats:
</p></div>
1182 <div class=
"olist arabic"><ol class=
"arabic">
1185 mode SP type SP sha1 TAB path
1187 <div class=
"paragraph"><p>This format is to stuff
<code>git ls-tree
</code> output into the index.
</p></div>
1191 mode SP sha1 SP stage TAB path
1193 <div class=
"paragraph"><p>This format is to put higher order stages into the
1194 index file and matches
<em>git ls-files --stage
</em> output.
</p></div>
1198 mode SP sha1 TAB path
1200 <div class=
"paragraph"><p>This format is no longer produced by any Git command, but is
1201 and will continue to be supported by
<code>update-index --index-info
</code>.
</p></div>
1204 <div class=
"paragraph"><p>To place a higher stage entry to the index, the path should
1205 first be removed by feeding a mode=
0 entry for the path, and
1206 then feeding necessary input lines in the third format.
</p></div>
1207 <div class=
"paragraph"><p>For example, starting with this index:
</p></div>
1208 <div class=
"listingblock">
1209 <div class=
"content">
1210 <pre><code>$ git ls-files -s
1211 100644 8a1218a1024a212bb3db30becd860315f9f3ac52
0 frotz
</code></pre>
1213 <div class=
"paragraph"><p>you can feed the following input to
<code>--index-info
</code>:
</p></div>
1214 <div class=
"listingblock">
1215 <div class=
"content">
1216 <pre><code>$ git update-index --index-info
1217 0 0000000000000000000000000000000000000000 frotz
1218 100644 8a1218a1024a212bb3db30becd860315f9f3ac52
1 frotz
1219 100755 8a1218a1024a212bb3db30becd860315f9f3ac52
2 frotz
</code></pre>
1221 <div class=
"paragraph"><p>The first line of the input feeds
0 as the mode to remove the
1222 path; the SHA-
1 does not matter as long as it is well formatted.
1223 Then the second and third line feeds stage
1 and stage
2 entries
1224 for that path. After the above, we would end up with this:
</p></div>
1225 <div class=
"listingblock">
1226 <div class=
"content">
1227 <pre><code>$ git ls-files -s
1228 100644 8a1218a1024a212bb3db30becd860315f9f3ac52
1 frotz
1229 100755 8a1218a1024a212bb3db30becd860315f9f3ac52
2 frotz
</code></pre>
1234 <h2 id=
"_using_8220_assume_unchanged_8221_bit">USING
“ASSUME UNCHANGED
” BIT
</h2>
1235 <div class=
"sectionbody">
1236 <div class=
"paragraph"><p>Many operations in Git depend on your filesystem to have an
1237 efficient
<code>lstat(
2)
</code> implementation, so that
<code>st_mtime
</code>
1238 information for working tree files can be cheaply checked to see
1239 if the file contents have changed from the version recorded in
1240 the index file. Unfortunately, some filesystems have
1241 inefficient
<code>lstat(
2)
</code>. If your filesystem is one of them, you
1242 can set
"assume unchanged" bit to paths you have not changed to
1243 cause Git not to do this check. Note that setting this bit on a
1244 path does not mean Git will check the contents of the file to
1245 see if it has changed
 — it makes Git to omit any checking and
1246 assume it has
<strong>not
</strong> changed. When you make changes to working
1247 tree files, you have to explicitly tell Git about it by dropping
1248 "assume unchanged" bit, either before or after you modify them.
</p></div>
1249 <div class=
"paragraph"><p>In order to set
"assume unchanged" bit, use
<code>--assume-unchanged
</code>
1250 option. To unset, use
<code>--no-assume-unchanged
</code>. To see which files
1251 have the
"assume unchanged" bit set, use
<code>git ls-files -v
</code>
1252 (see
<a href=
"git-ls-files.html">git-ls-files(
1)
</a>).
</p></div>
1253 <div class=
"paragraph"><p>The command looks at
<code>core.ignorestat
</code> configuration variable. When
1254 this is true, paths updated with
<code>git update-index paths...
</code> and
1255 paths updated with other Git commands that update both index and
1256 working tree (e.g.
<em>git apply --index
</em>,
<em>git checkout-index -u
</em>,
1257 and
<em>git read-tree -u
</em>) are automatically marked as
"assume
1258 unchanged". Note that
"assume unchanged" bit is
<strong>not
</strong> set if
1259 <code>git update-index --refresh
</code> finds the working tree file matches
1260 the index (use
<code>git update-index --really-refresh
</code> if you want
1261 to mark them as
"assume unchanged").
</p></div>
1262 <div class=
"paragraph"><p>Sometimes users confuse the assume-unchanged bit with the
1263 skip-worktree bit. See the final paragraph in the
"Skip-worktree bit"
1264 section below for an explanation of the differences.
</p></div>
1268 <h2 id=
"_examples">EXAMPLES
</h2>
1269 <div class=
"sectionbody">
1270 <div class=
"paragraph"><p>To update and refresh only the files already checked out:
</p></div>
1271 <div class=
"listingblock">
1272 <div class=
"content">
1273 <pre><code>$ git checkout-index -n -f -a
&& git update-index --ignore-missing --refresh
</code></pre>
1275 <div class=
"dlist"><dl>
1276 <dt class=
"hdlist1">
1277 On an inefficient filesystem with
<code>core.ignorestat
</code> set
1280 <div class=
"listingblock">
1281 <div class=
"content">
1282 <pre><code>$ git update-index --really-refresh
<b><1></b>
1283 $ git update-index --no-assume-unchanged foo.c
<b><2></b>
1284 $ git diff --name-only
<b><3></b>
1286 $ git diff --name-only
<b><4></b>
1288 $ git update-index foo.c
<b><5></b>
1289 $ git diff --name-only
<b><6></b>
1291 $ git diff --name-only
<b><7></b>
1292 $ git update-index --no-assume-unchanged foo.c
<b><8></b>
1293 $ git diff --name-only
<b><9></b>
1294 M foo.c
</code></pre>
1296 <div class=
"colist arabic"><ol>
1299 forces lstat(
2) to set
"assume unchanged" bits for paths that match index.
1304 mark the path to be edited.
1309 this does lstat(
2) and finds index matches the path.
1314 this does lstat(
2) and finds index does
<strong>not
</strong> match the path.
1319 registering the new version to index sets
"assume unchanged" bit.
1324 and it is assumed unchanged.
1329 even after you edit it.
1334 you can tell about the change after the fact.
1339 now it checks with lstat(
2) and finds it has been changed.
1348 <h2 id=
"_skip_worktree_bit">SKIP-WORKTREE BIT
</h2>
1349 <div class=
"sectionbody">
1350 <div class=
"paragraph"><p>Skip-worktree bit can be defined in one (long) sentence: Tell git to
1351 avoid writing the file to the working directory when reasonably
1352 possible, and treat the file as unchanged when it is not
1353 present in the working directory.
</p></div>
1354 <div class=
"paragraph"><p>Note that not all git commands will pay attention to this bit, and
1355 some only partially support it.
</p></div>
1356 <div class=
"paragraph"><p>The update-index flags and the read-tree capabilities relating to the
1357 skip-worktree bit predated the introduction of the
1358 <a href=
"git-sparse-checkout.html">git-sparse-checkout(
1)
</a> command, which provides a much easier
1359 way to configure and handle the skip-worktree bits. If you want to
1360 reduce your working tree to only deal with a subset of the files in
1361 the repository, we strongly encourage the use of
1362 <a href=
"git-sparse-checkout.html">git-sparse-checkout(
1)
</a> in preference to the low-level
1363 update-index and read-tree primitives.
</p></div>
1364 <div class=
"paragraph"><p>The primary purpose of the skip-worktree bit is to enable sparse
1365 checkouts, i.e. to have working directories with only a subset of
1366 paths present. When the skip-worktree bit is set, Git commands (such
1367 as
<code>switch
</code>,
<code>pull
</code>,
<code>merge
</code>) will avoid writing these files.
1368 However, these commands will sometimes write these files anyway in
1369 important cases such as conflicts during a merge or rebase. Git
1370 commands will also avoid treating the lack of such files as an
1371 intentional deletion; for example
<code>git add -u
</code> will not stage a
1372 deletion for these files and
<code>git commit -a
</code> will not make a commit
1373 deleting them either.
</p></div>
1374 <div class=
"paragraph"><p>Although this bit looks similar to assume-unchanged bit, its goal is
1375 different. The assume-unchanged bit is for leaving the file in the
1376 working tree but having Git omit checking it for changes and presuming
1377 that the file has not been changed (though if it can determine without
1378 stat
’ing the file that it has changed, it is free to record the
1379 changes). skip-worktree tells Git to ignore the absence of the file,
1380 avoid updating it when possible with commands that normally update
1381 much of the working directory (e.g.
<code>checkout
</code>,
<code>switch
</code>,
<code>pull
</code>,
1382 etc.), and not have its absence be recorded in commits. Note that in
1383 sparse checkouts (setup by
<code>git sparse-checkout
</code> or by configuring
1384 core.sparseCheckout to true), if a file is marked as skip-worktree in
1385 the index but is found in the working tree, Git will clear the
1386 skip-worktree bit for that file.
</p></div>
1390 <h2 id=
"_split_index">SPLIT INDEX
</h2>
1391 <div class=
"sectionbody">
1392 <div class=
"paragraph"><p>This mode is designed for repositories with very large indexes, and
1393 aims at reducing the time it takes to repeatedly write these indexes.
</p></div>
1394 <div class=
"paragraph"><p>In this mode, the index is split into two files, $GIT_DIR/index and
1395 $GIT_DIR/sharedindex.
<SHA-
1>. Changes are accumulated in
1396 $GIT_DIR/index, the split index, while the shared index file contains
1397 all index entries and stays unchanged.
</p></div>
1398 <div class=
"paragraph"><p>All changes in the split index are pushed back to the shared index
1399 file when the number of entries in the split index reaches a level
1400 specified by the splitIndex.maxPercentChange config variable (see
1401 <a href=
"git-config.html">git-config(
1)
</a>).
</p></div>
1402 <div class=
"paragraph"><p>Each time a new shared index file is created, the old shared index
1403 files are deleted if their modification time is older than what is
1404 specified by the splitIndex.sharedIndexExpire config variable (see
1405 <a href=
"git-config.html">git-config(
1)
</a>).
</p></div>
1406 <div class=
"paragraph"><p>To avoid deleting a shared index file that is still used, its
1407 modification time is updated to the current time every time a new split
1408 index based on the shared index file is either created or read from.
</p></div>
1412 <h2 id=
"_untracked_cache">UNTRACKED CACHE
</h2>
1413 <div class=
"sectionbody">
1414 <div class=
"paragraph"><p>This cache is meant to speed up commands that involve determining
1415 untracked files such as
<code>git status
</code>.
</p></div>
1416 <div class=
"paragraph"><p>This feature works by recording the mtime of the working tree
1417 directories and then omitting reading directories and stat calls
1418 against files in those directories whose mtime hasn
’t changed. For
1419 this to work the underlying operating system and file system must
1420 change the
<code>st_mtime
</code> field of directories if files in the directory
1421 are added, modified or deleted.
</p></div>
1422 <div class=
"paragraph"><p>You can test whether the filesystem supports that with the
1423 <code>--test-untracked-cache
</code> option. The
<code>--untracked-cache
</code> option used
1424 to implicitly perform that test in older versions of Git, but that
’s
1425 no longer the case.
</p></div>
1426 <div class=
"paragraph"><p>If you want to enable (or disable) this feature, it is easier to use
1427 the
<code>core.untrackedCache
</code> configuration variable (see
1428 <a href=
"git-config.html">git-config(
1)
</a>) than using the
<code>--untracked-cache
</code> option to
1429 <code>git update-index
</code> in each repository, especially if you want to do so
1430 across all repositories you use, because you can set the configuration
1431 variable to
<code>true
</code> (or
<code>false
</code>) in your
<code>$HOME/.gitconfig
</code> just once
1432 and have it affect all repositories you touch.
</p></div>
1433 <div class=
"paragraph"><p>When the
<code>core.untrackedCache
</code> configuration variable is changed, the
1434 untracked cache is added to or removed from the index the next time a
1435 command reads the index; while when
<code>--[no-|force-]untracked-cache
</code>
1436 are used, the untracked cache is immediately added to or removed from
1437 the index.
</p></div>
1438 <div class=
"paragraph"><p>Before
2.17, the untracked cache had a bug where replacing a directory
1439 with a symlink to another directory could cause it to incorrectly show
1440 files tracked by git as untracked. See the
"status: add a failing test
1441 showing a core.untrackedCache bug" commit to git.git. A workaround for
1442 that is (and this might work for other undiscovered bugs in the
1444 <div class=
"listingblock">
1445 <div class=
"content">
1446 <pre><code>$ git -c core.untrackedCache=false status
</code></pre>
1448 <div class=
"paragraph"><p>This bug has also been shown to affect non-symlink cases of replacing
1449 a directory with a file when it comes to the internal structures of
1450 the untracked cache, but no case has been reported where this resulted in
1451 wrong
"git status" output.
</p></div>
1452 <div class=
"paragraph"><p>There are also cases where existing indexes written by git versions
1453 before
2.17 will reference directories that don
’t exist anymore,
1454 potentially causing many
"could not open directory" warnings to be
1455 printed on
"git status". These are new warnings for existing issues
1456 that were previously silently discarded.
</p></div>
1457 <div class=
"paragraph"><p>As with the bug described above the solution is to one-off do a
"git
1458 status" run with
<code>core.untrackedCache=false
</code> to flush out the leftover
1463 <h2 id=
"_file_system_monitor">FILE SYSTEM MONITOR
</h2>
1464 <div class=
"sectionbody">
1465 <div class=
"paragraph"><p>This feature is intended to speed up git operations for repos that have
1466 large working directories.
</p></div>
1467 <div class=
"paragraph"><p>It enables git to work together with a file system monitor (see
1468 <a href=
"git-fsmonitor--daemon.html">git-fsmonitor
--daemon(
1)
</a>
1470 "fsmonitor-watchman" section of
<a href=
"githooks.html">githooks(
5)
</a>) that can
1471 inform it as to what files have been modified. This enables git to avoid
1472 having to lstat() every file to find modified files.
</p></div>
1473 <div class=
"paragraph"><p>When used in conjunction with the untracked cache, it can further improve
1474 performance by avoiding the cost of scanning the entire working directory
1475 looking for new files.
</p></div>
1476 <div class=
"paragraph"><p>If you want to enable (or disable) this feature, it is easier to use
1477 the
<code>core.fsmonitor
</code> configuration variable (see
1478 <a href=
"git-config.html">git-config(
1)
</a>) than using the
<code>--fsmonitor
</code> option to
<code>git
1479 update-index
</code> in each repository, especially if you want to do so
1480 across all repositories you use, because you can set the configuration
1481 variable in your
<code>$HOME/.gitconfig
</code> just once and have it affect all
1482 repositories you touch.
</p></div>
1483 <div class=
"paragraph"><p>When the
<code>core.fsmonitor
</code> configuration variable is changed, the
1484 file system monitor is added to or removed from the index the next time
1485 a command reads the index. When
<code>--[no-]fsmonitor
</code> are used, the file
1486 system monitor is immediately added to or removed from the index.
</p></div>
1490 <h2 id=
"_configuration">CONFIGURATION
</h2>
1491 <div class=
"sectionbody">
1492 <div class=
"paragraph"><p>The command honors
<code>core.filemode
</code> configuration variable. If
1493 your repository is on a filesystem whose executable bits are
1494 unreliable, this should be set to
<em>false
</em> (see
<a href=
"git-config.html">git-config(
1)
</a>).
1495 This causes the command to ignore differences in file modes recorded
1496 in the index and the file mode on the filesystem if they differ only on
1497 executable bit. On such an unfortunate filesystem, you may
1498 need to use
<em>git update-index --chmod=
</em>.
</p></div>
1499 <div class=
"paragraph"><p>Quite similarly, if
<code>core.symlinks
</code> configuration variable is set
1500 to
<em>false
</em> (see
<a href=
"git-config.html">git-config(
1)
</a>), symbolic links are checked out
1501 as plain files, and this command does not modify a recorded file mode
1502 from symbolic link to regular file.
</p></div>
1503 <div class=
"paragraph"><p>The command looks at
<code>core.ignorestat
</code> configuration variable. See
1504 <em>Using
"assume unchanged" bit
</em> section above.
</p></div>
1505 <div class=
"paragraph"><p>The command also looks at
<code>core.trustctime
</code> configuration variable.
1506 It can be useful when the inode change time is regularly modified by
1507 something outside Git (file system crawlers and backup systems use
1508 ctime for marking files processed) (see
<a href=
"git-config.html">git-config(
1)
</a>).
</p></div>
1509 <div class=
"paragraph"><p>The untracked cache extension can be enabled by the
1510 <code>core.untrackedCache
</code> configuration variable (see
1511 <a href=
"git-config.html">git-config(
1)
</a>).
</p></div>
1515 <h2 id=
"_notes">NOTES
</h2>
1516 <div class=
"sectionbody">
1517 <div class=
"paragraph"><p>Users often try to use the assume-unchanged and skip-worktree bits
1518 to tell Git to ignore changes to files that are tracked. This does not
1519 work as expected, since Git may still check working tree files against
1520 the index when performing certain operations. In general, Git does not
1521 provide a way to ignore changes to tracked files, so alternate solutions
1522 are recommended.
</p></div>
1523 <div class=
"paragraph"><p>For example, if the file you want to change is some sort of config file,
1524 the repository can include a sample config file that can then be copied
1525 into the ignored name and modified. The repository can even include a
1526 script to treat the sample file as a template, modifying and copying it
1527 automatically.
</p></div>
1531 <h2 id=
"_see_also">SEE ALSO
</h2>
1532 <div class=
"sectionbody">
1533 <div class=
"paragraph"><p><a href=
"git-config.html">git-config(
1)
</a>,
1534 <a href=
"git-add.html">git-add(
1)
</a>,
1535 <a href=
"git-ls-files.html">git-ls-files(
1)
</a></p></div>
1539 <h2 id=
"_git">GIT
</h2>
1540 <div class=
"sectionbody">
1541 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
1545 <div id=
"footnotes"><hr /></div>
1547 <div id=
"footer-text">
1549 2022-
09-
15 16:
31:
06 PDT