<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | |
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<meta name="generator" content="AsciiDoc 7.0.2" /> | |
<style type="text/css"> | |
/* Debug borders */ | |
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { | |
/* | |
border: 1px solid red; | |
*/ | |
} | |
body { | |
margin: 1em 5% 1em 5%; | |
} | |
a { color: blue; } | |
a:visited { color: fuchsia; } | |
em { | |
font-style: italic; | |
} | |
strong { | |
font-weight: bold; | |
} | |
tt { | |
color: navy; | |
} | |
h1, h2, h3, h4, h5, h6 { | |
color: #527bbd; | |
font-family: sans-serif; | |
margin-top: 1.2em; | |
margin-bottom: 0.5em; | |
line-height: 1.3; | |
} | |
h1 { | |
border-bottom: 2px solid silver; | |
} | |
h2 { | |
border-bottom: 2px solid silver; | |
padding-top: 0.5em; | |
} | |
div.sectionbody { | |
font-family: serif; | |
margin-left: 0; | |
} | |
hr { | |
border: 1px solid silver; | |
} | |
p { | |
margin-top: 0.5em; | |
margin-bottom: 0.5em; | |
} | |
pre { | |
padding: 0; | |
margin: 0; | |
} | |
span#author { | |
color: #527bbd; | |
font-family: sans-serif; | |
font-weight: bold; | |
font-size: 1.2em; | |
} | |
span#email { | |
} | |
span#revision { | |
font-family: sans-serif; | |
} | |
div#footer { | |
font-family: sans-serif; | |
font-size: small; | |
border-top: 2px solid silver; | |
padding-top: 0.5em; | |
margin-top: 4.0em; | |
} | |
div#footer-text { | |
float: left; | |
padding-bottom: 0.5em; | |
} | |
div#footer-badges { | |
float: right; | |
padding-bottom: 0.5em; | |
} | |
div#preamble, | |
div.tableblock, div.imageblock, div.exampleblock, div.verseblock, | |
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, | |
div.admonitionblock { | |
margin-right: 10%; | |
margin-top: 1.5em; | |
margin-bottom: 1.5em; | |
} | |
div.admonitionblock { | |
margin-top: 2.5em; | |
margin-bottom: 2.5em; | |
} | |
div.content { /* Block element content. */ | |
padding: 0; | |
} | |
/* Block element titles. */ | |
div.title, caption.title { | |
font-family: sans-serif; | |
font-weight: bold; | |
text-align: left; | |
margin-top: 1.0em; | |
margin-bottom: 0.5em; | |
} | |
div.title + * { | |
margin-top: 0; | |
} | |
td div.title:first-child { | |
margin-top: 0.0em; | |
} | |
div.content div.title:first-child { | |
margin-top: 0.0em; | |
} | |
div.content + div.title { | |
margin-top: 0.0em; | |
} | |
div.sidebarblock > div.content { | |
background: #ffffee; | |
border: 1px solid silver; | |
padding: 0.5em; | |
} | |
div.listingblock > div.content { | |
border: 1px solid silver; | |
background: #f4f4f4; | |
padding: 0.5em; | |
} | |
div.quoteblock > div.content { | |
padding-left: 2.0em; | |
} | |
div.quoteblock .attribution { | |
text-align: right; | |
} | |
div.admonitionblock .icon { | |
vertical-align: top; | |
font-size: 1.1em; | |
font-weight: bold; | |
text-decoration: underline; | |
color: #527bbd; | |
padding-right: 0.5em; | |
} | |
div.admonitionblock td.content { | |
padding-left: 0.5em; | |
border-left: 2px solid silver; | |
} | |
div.exampleblock > div.content { | |
border-left: 2px solid silver; | |
padding: 0.5em; | |
} | |
div.verseblock div.content { | |
white-space: pre; | |
} | |
div.imageblock div.content { padding-left: 0; } | |
div.imageblock img { border: 1px solid silver; } | |
span.image img { border-style: none; } | |
dl { | |
margin-top: 0.8em; | |
margin-bottom: 0.8em; | |
} | |
dt { | |
margin-top: 0.5em; | |
margin-bottom: 0; | |
font-style: italic; | |
} | |
dd > *:first-child { | |
margin-top: 0; | |
} | |
ul, ol { | |
list-style-position: outside; | |
} | |
ol.olist2 { | |
list-style-type: lower-alpha; | |
} | |
div.tableblock > table { | |
border-color: #527bbd; | |
border-width: 3px; | |
} | |
thead { | |
font-family: sans-serif; | |
font-weight: bold; | |
} | |
tfoot { | |
font-weight: bold; | |
} | |
div.hlist { | |
margin-top: 0.8em; | |
margin-bottom: 0.8em; | |
} | |
td.hlist1 { | |
vertical-align: top; | |
font-style: italic; | |
padding-right: 0.8em; | |
} | |
td.hlist2 { | |
vertical-align: top; | |
} | |
@media print { | |
div#footer-badges { display: none; } | |
} | |
include::./stylesheets/xhtml11-manpage.css[] | |
/* Workarounds for IE6's broken and incomplete CSS2. */ | |
div.sidebar-content { | |
background: #ffffee; | |
border: 1px solid silver; | |
padding: 0.5em; | |
} | |
div.sidebar-title, div.image-title { | |
font-family: sans-serif; | |
font-weight: bold; | |
margin-top: 0.0em; | |
margin-bottom: 0.5em; | |
} | |
div.listingblock div.content { | |
border: 1px solid silver; | |
background: #f4f4f4; | |
padding: 0.5em; | |
} | |
div.quoteblock-content { | |
padding-left: 2.0em; | |
} | |
div.exampleblock-content { | |
border-left: 2px solid silver; | |
padding-left: 0.5em; | |
} | |
</style> | |
<title>git-update-index(1)</title> | |
</head> | |
<body> | |
<div id="header"> | |
<h1> | |
git-update-index(1) Manual Page | |
</h1> | |
<h2>NAME</h2> | |
<div class="sectionbody"> | |
<p>git-update-index - | |
Modifies the index or directory cache | |
</p> | |
</div> | |
</div> | |
<h2>SYNOPSIS</h2> | |
<div class="sectionbody"> | |
<div class="verseblock"> | |
<div class="content"><em>git-update-index</em> | |
[--add] [--remove | --force-remove] [--replace] | |
[--refresh] [-q] [--unmerged] [--ignore-missing] | |
[--cacheinfo <mode> <object> <file>]* | |
[--chmod=(+|-)x] | |
[--assume-unchanged | --no-assume-unchanged] | |
[--really-refresh] [--unresolve] [--again | -g] | |
[--info-only] [--index-info] | |
[-z] [--stdin] | |
[--verbose] | |
[--] [<file>]*</div></div> | |
</div> | |
<h2>DESCRIPTION</h2> | |
<div class="sectionbody"> | |
<p>Modifies the index or directory cache. Each file mentioned is updated | |
into the index and any <em>unmerged</em> or <em>needs updating</em> state is | |
cleared.</p> | |
<p>The way "git-update-index" handles files it is told about can be modified | |
using the various options:</p> | |
</div> | |
<h2>OPTIONS</h2> | |
<div class="sectionbody"> | |
<dl> | |
<dt> | |
--add | |
</dt> | |
<dd> | |
<p> | |
If a specified file isn't in the index already then it's | |
added. | |
Default behaviour is to ignore new files. | |
</p> | |
</dd> | |
<dt> | |
--remove | |
</dt> | |
<dd> | |
<p> | |
If a specified file is in the index but is missing then it's | |
removed. | |
Default behavior is to ignore removed file. | |
</p> | |
</dd> | |
<dt> | |
--refresh | |
</dt> | |
<dd> | |
<p> | |
Looks at the current index and checks to see if merges or | |
updates are needed by checking stat() information. | |
</p> | |
</dd> | |
<dt> | |
-q | |
</dt> | |
<dd> | |
<p> | |
Quiet. If --refresh finds that the index needs an update, the | |
default behavior is to error out. This option makes | |
git-update-index continue anyway. | |
</p> | |
</dd> | |
<dt> | |
--unmerged | |
</dt> | |
<dd> | |
<p> | |
If --refresh finds unmerged changes in the index, the default | |
behavior is to error out. This option makes git-update-index | |
continue anyway. | |
</p> | |
</dd> | |
<dt> | |
--ignore-missing | |
</dt> | |
<dd> | |
<p> | |
Ignores missing files during a --refresh | |
</p> | |
</dd> | |
<dt> | |
--cacheinfo <mode> <object> <path> | |
</dt> | |
<dd> | |
<p> | |
Directly insert the specified info into the index. | |
</p> | |
</dd> | |
<dt> | |
--index-info | |
</dt> | |
<dd> | |
<p> | |
Read index information from stdin. | |
</p> | |
</dd> | |
<dt> | |
--chmod=(+|-)x | |
</dt> | |
<dd> | |
<p> | |
Set the execute permissions on the updated files. | |
</p> | |
</dd> | |
<dt> | |
--assume-unchanged, --no-assume-unchanged | |
</dt> | |
<dd> | |
<p> | |
When these flags are specified, the object name recorded | |
for the paths are not updated. Instead, these options | |
sets and unsets the "assume unchanged" bit for the | |
paths. When the "assume unchanged" bit is on, git stops | |
checking the working tree files for possible | |
modifications, so you need to manually unset the bit to | |
tell git when you change the working tree file. This is | |
sometimes helpful when working with a big project on a | |
filesystem that has very slow lstat(2) system call | |
(e.g. cifs). | |
</p> | |
</dd> | |
<dt> | |
--again, -g | |
</dt> | |
<dd> | |
<p> | |
Runs <tt>git-update-index</tt> itself on the paths whose index | |
entries are different from those from the <tt>HEAD</tt> commit. | |
</p> | |
</dd> | |
<dt> | |
--unresolve | |
</dt> | |
<dd> | |
<p> | |
Restores the <em>unmerged</em> or <em>needs updating</em> state of a | |
file during a merge if it was cleared by accident. | |
</p> | |
</dd> | |
<dt> | |
--info-only | |
</dt> | |
<dd> | |
<p> | |
Do not create objects in the object database for all | |
<file> arguments that follow this flag; just insert | |
their object IDs into the index. | |
</p> | |
</dd> | |
<dt> | |
--force-remove | |
</dt> | |
<dd> | |
<p> | |
Remove the file from the index even when the working directory | |
still has such a file. (Implies --remove.) | |
</p> | |
</dd> | |
<dt> | |
--replace | |
</dt> | |
<dd> | |
<p> | |
By default, when a file <tt>path</tt> exists in the index, | |
git-update-index refuses an attempt to add <tt>path/file</tt>. | |
Similarly if a file <tt>path/file</tt> exists, a file <tt>path</tt> | |
cannot be added. With --replace flag, existing entries | |
that conflicts with the entry being added are | |
automatically removed with warning messages. | |
</p> | |
</dd> | |
<dt> | |
--stdin | |
</dt> | |
<dd> | |
<p> | |
Instead of taking list of paths from the command line, | |
read list of paths from the standard input. Paths are | |
separated by LF (i.e. one path per line) by default. | |
</p> | |
</dd> | |
<dt> | |
--verbose | |
</dt> | |
<dd> | |
<p> | |
Report what is being added and removed from index. | |
</p> | |
</dd> | |
<dt> | |
-z | |
</dt> | |
<dd> | |
<p> | |
Only meaningful with <tt>--stdin</tt>; paths are separated with | |
NUL character instead of LF. | |
</p> | |
</dd> | |
<dt> | |
-- | |
</dt> | |
<dd> | |
<p> | |
Do not interpret any more arguments as options. | |
</p> | |
</dd> | |
<dt> | |
<file> | |
</dt> | |
<dd> | |
<p> | |
Files to act on. | |
Note that files beginning with <em>.</em> are discarded. This includes | |
<tt>./file</tt> and <tt>dir/./file</tt>. If you don't want this, then use | |
cleaner names. | |
The same applies to directories ending <em>/</em> and paths with <em>//</em> | |
</p> | |
</dd> | |
</dl> | |
</div> | |
<h2>Using --refresh</h2> | |
<div class="sectionbody"> | |
<p><em>--refresh</em> does not calculate a new sha1 file or bring the index | |
up-to-date for mode/content changes. But what it <strong>does</strong> do is to | |
"re-match" the stat information of a file with the index, so that you | |
can refresh the index for a file that hasn't been changed but where | |
the stat entry is out of date.</p> | |
<p>For example, you'd want to do this after doing a "git-read-tree", to link | |
up the stat index details with the proper files.</p> | |
</div> | |
<h2>Using --cacheinfo or --info-only</h2> | |
<div class="sectionbody"> | |
<p><em>--cacheinfo</em> is used to register a file that is not in the | |
current working directory. This is useful for minimum-checkout | |
merging.</p> | |
<p>To pretend you have a file with mode and sha1 at path, say:</p> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>$ git-update-index --cacheinfo mode sha1 path</tt></pre> | |
</div></div> | |
<p><em>--info-only</em> is used to register files without placing them in the object | |
database. This is useful for status-only repositories.</p> | |
<p>Both <em>--cacheinfo</em> and <em>--info-only</em> behave similarly: the index is updated | |
but the object database isn't. <em>--cacheinfo</em> is useful when the object is | |
in the database but the file isn't available locally. <em>--info-only</em> is | |
useful when the file is available, but you do not wish to update the | |
object database.</p> | |
</div> | |
<h2>Using --index-info</h2> | |
<div class="sectionbody"> | |
<p><tt>--index-info</tt> is a more powerful mechanism that lets you feed | |
multiple entry definitions from the standard input, and designed | |
specifically for scripts. It can take inputs of three formats:</p> | |
<ol> | |
<li> | |
<p> | |
mode SP sha1 TAB path | |
</p> | |
<p>The first format is what "git-apply --index-info" | |
reports, and used to reconstruct a partial tree | |
that is used for phony merge base tree when falling | |
back on 3-way merge.</p> | |
</li> | |
<li> | |
<p> | |
mode SP type SP sha1 TAB path | |
</p> | |
<p>The second format is to stuff git-ls-tree output | |
into the index file.</p> | |
</li> | |
<li> | |
<p> | |
mode SP sha1 SP stage TAB path | |
</p> | |
<p>This format is to put higher order stages into the | |
index file and matches git-ls-files --stage output.</p> | |
</li> | |
</ol> | |
<p>To place a higher stage entry to the index, the path should | |
first be removed by feeding a mode=0 entry for the path, and | |
then feeding necessary input lines in the third format.</p> | |
<p>For example, starting with this index:</p> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>$ git ls-files -s | |
100644 8a1218a1024a212bb3db30becd860315f9f3ac52 0 frotz</tt></pre> | |
</div></div> | |
<p>you can feed the following input to <tt>--index-info</tt>:</p> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>$ git update-index --index-info | |
0 0000000000000000000000000000000000000000 frotz | |
100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1 frotz | |
100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2 frotz</tt></pre> | |
</div></div> | |
<p>The first line of the input feeds 0 as the mode to remove the | |
path; the SHA1 does not matter as long as it is well formatted. | |
Then the second and third line feeds stage 1 and stage 2 entries | |
for that path. After the above, we would end up with this:</p> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>$ git ls-files -s | |
100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1 frotz | |
100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2 frotz</tt></pre> | |
</div></div> | |
</div> | |
<h2>Using “assume unchanged” bit</h2> | |
<div class="sectionbody"> | |
<p>Many operations in git depend on your filesystem to have an | |
efficient <tt>lstat(2)</tt> implementation, so that <tt>st_mtime</tt> | |
information for working tree files can be cheaply checked to see | |
if the file contents have changed from the version recorded in | |
the index file. Unfortunately, some filesystems have | |
inefficient <tt>lstat(2)</tt>. If your filesystem is one of them, you | |
can set "assume unchanged" bit to paths you have not changed to | |
cause git not to do this check. Note that setting this bit on a | |
path does not mean git will check the contents of the file to | |
see if it has changed — it makes git to omit any checking and | |
assume it has <strong>not</strong> changed. When you make changes to working | |
tree files, you have to explicitly tell git about it by dropping | |
"assume unchanged" bit, either before or after you modify them.</p> | |
<p>In order to set "assume unchanged" bit, use <tt>--assume-unchanged</tt> | |
option. To unset, use <tt>--no-assume-unchanged</tt>.</p> | |
<p>The command looks at <tt>core.ignorestat</tt> configuration variable. When | |
this is true, paths updated with <tt>git-update-index paths…</tt> and | |
paths updated with other git commands that update both index and | |
working tree (e.g. <tt>git-apply --index</tt>, <tt>git-checkout-index -u</tt>, | |
and <tt>git-read-tree -u</tt>) are automatically marked as "assume | |
unchanged". Note that "assume unchanged" bit is <strong>not</strong> set if | |
<tt>git-update-index --refresh</tt> finds the working tree file matches | |
the index (use <tt>git-update-index --really-refresh</tt> if you want | |
to mark them as "assume unchanged").</p> | |
</div> | |
<h2>Examples</h2> | |
<div class="sectionbody"> | |
<p>To update and refresh only the files already checked out:</p> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>$ git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh</tt></pre> | |
</div></div> | |
<dl> | |
<dt> | |
On an inefficient filesystem with <tt>core.ignorestat</tt> set | |
</dt> | |
<dd> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>$ git update-index --really-refresh <b>(1)</b> | |
$ git update-index --no-assume-unchanged foo.c <b>(2)</b> | |
$ git diff --name-only <b>(3)</b> | |
$ edit foo.c | |
$ git diff --name-only <b>(4)</b> | |
M foo.c | |
$ git update-index foo.c <b>(5)</b> | |
$ git diff --name-only <b>(6)</b> | |
$ edit foo.c | |
$ git diff --name-only <b>(7)</b> | |
$ git update-index --no-assume-unchanged foo.c <b>(8)</b> | |
$ git diff --name-only <b>(9)</b> | |
M foo.c</tt></pre> | |
</div></div> | |
<ol> | |
<li> | |
<p> | |
forces lstat(2) to set "assume unchanged" bits for paths that match index. | |
</p> | |
</li> | |
<li> | |
<p> | |
mark the path to be edited. | |
</p> | |
</li> | |
<li> | |
<p> | |
this does lstat(2) and finds index matches the path. | |
</p> | |
</li> | |
<li> | |
<p> | |
this does lstat(2) and finds index does <strong>not</strong> match the path. | |
</p> | |
</li> | |
<li> | |
<p> | |
registering the new version to index sets "assume unchanged" bit. | |
</p> | |
</li> | |
<li> | |
<p> | |
and it is assumed unchanged. | |
</p> | |
</li> | |
<li> | |
<p> | |
even after you edit it. | |
</p> | |
</li> | |
<li> | |
<p> | |
you can tell about the change after the fact. | |
</p> | |
</li> | |
<li> | |
<p> | |
now it checks with lstat(2) and finds it has been changed. | |
</p> | |
</li> | |
</ol> | |
</dd> | |
</dl> | |
</div> | |
<h2>Configuration</h2> | |
<div class="sectionbody"> | |
<p>The command honors <tt>core.filemode</tt> configuration variable. If | |
your repository is on an filesystem whose executable bits are | |
unreliable, this should be set to <em>false</em> (see <a href="git-repo-config.html">git-repo-config(1)</a>). | |
This causes the command to ignore differences in file modes recorded | |
in the index and the file mode on the filesystem if they differ only on | |
executable bit. On such an unfortunate filesystem, you may | |
need to use <tt>git-update-index --chmod=</tt>.</p> | |
<p>The command looks at <tt>core.ignorestat</tt> configuration variable. See | |
<em>Using "assume unchanged" bit</em> section above.</p> | |
</div> | |
<h2>See Also</h2> | |
<div class="sectionbody"> | |
<p><a href="git-repo-config.html">git-repo-config(1)</a></p> | |
</div> | |
<h2>Author</h2> | |
<div class="sectionbody"> | |
<p>Written by Linus Torvalds <torvalds@osdl.org></p> | |
</div> | |
<h2>Documentation</h2> | |
<div class="sectionbody"> | |
<p>Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.</p> | |
</div> | |
<h2>GIT</h2> | |
<div class="sectionbody"> | |
<p>Part of the <a href="git.html">git(7)</a> suite</p> | |
</div> | |
<div id="footer"> | |
<div id="footer-text"> | |
Last updated 13-Nov-2006 23:40:50 UTC | |
</div> | |
</div> | |
</body> | |
</html> |