Documentation updates.
[git/gitweb.git] / Documentation / git-update-index.txt
blob8b50efa4e6a4017edecacc1ed1c5f664c7c235fd
1 git-update-index(1)
2 ===================
4 NAME
5 ----
6 git-update-index - Modifies the index or directory cache
9 SYNOPSIS
10 --------
11 'git-update-index'
12              [--add] [--remove] [--unmerged] [--refresh] [--replace]
13              [--cacheinfo <mode> <object> <file>]\*
14              [--chmod=(+|-)x]
15              [--info-only]
16              [--force-remove]
17              [--stdin]
18              [--index-info]
19              [--ignore-missing]
20              [-z]
21              [--] [<file>]\*
23 DESCRIPTION
24 -----------
25 Modifies the index or directory cache. Each file mentioned is updated
26 into the cache and any 'unmerged' or 'needs updating' state is
27 cleared.
29 The way "git-update-index" handles files it is told about can be modified
30 using the various options:
32 OPTIONS
33 -------
34 --add::
35         If a specified file isn't in the cache already then it's
36         added.
37         Default behaviour is to ignore new files.
39 --remove::
40         If a specified file is in the cache but is missing then it's
41         removed.
42         Default behaviour is to ignore removed file.
44 --refresh::
45         Looks at the current cache and checks to see if merges or
46         updates are needed by checking stat() information.
48 --ignore-missing::
49         Ignores missing files during a --refresh
51 --cacheinfo <mode> <object> <path>::
52         Directly insert the specified info into the cache.
53         
54 --info-only::
55         Do not create objects in the object database for all
56         <file> arguments that follow this flag; just insert
57         their object IDs into the cache.
59 --force-remove::
60         Remove the file from the index even when the working directory
61         still has such a file. (Implies --remove.)
63 --replace::
64         By default, when a file `path` exists in the index,
65         git-update-index refuses an attempt to add `path/file`.
66         Similarly if a file `path/file` exists, a file `path`
67         cannot be added.  With --replace flag, existing entries
68         that conflicts with the entry being added are
69         automatically removed with warning messages.
71 --stdin::
72         Instead of taking list of paths from the command line,
73         read list of paths from the standard input.  Paths are
74         separated by LF (i.e. one path per line) by default.
76 -z::
77         Only meaningful with `--stdin`; paths are separated with
78         NUL character instead of LF.
80 --::
81         Do not interpret any more arguments as options.
83 <file>::
84         Files to act on.
85         Note that files beginning with '.' are discarded. This includes
86         `./file` and `dir/./file`. If you don't want this, then use     
87         cleaner names.
88         The same applies to directories ending '/' and paths with '//'
90 Using --refresh
91 ---------------
92 '--refresh' does not calculate a new sha1 file or bring the cache
93 up-to-date for mode/content changes. But what it *does* do is to
94 "re-match" the stat information of a file with the cache, so that you
95 can refresh the cache for a file that hasn't been changed but where
96 the stat entry is out of date.
98 For example, you'd want to do this after doing a "git-read-tree", to link
99 up the stat cache details with the proper files.
101 Using --cacheinfo or --info-only
102 --------------------------------
103 '--cacheinfo' is used to register a file that is not in the
104 current working directory.  This is useful for minimum-checkout
105 merging.
107 To pretend you have a file with mode and sha1 at path, say:
109    $ git-update-index --cacheinfo mode sha1 path
111 '--info-only' is used to register files without placing them in the object
112 database.  This is useful for status-only repositories.
114 Both '--cacheinfo' and '--info-only' behave similarly: the index is updated
115 but the object database isn't.  '--cacheinfo' is useful when the object is
116 in the database but the file isn't available locally.  '--info-only' is
117 useful when the file is available, but you do not wish to update the
118 object database.
120 Examples
121 --------
122 To update and refresh only the files already checked out:
124    git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh
127 Configuration
128 -------------
130 The command honors `core.filemode` configuration variable.  If
131 your repository is on an filesystem whose executable bits are
132 unreliable, this should be set to 'false'.  This causes the
133 command to ignore differences in file modes recorded in the
134 index and the file mode on the filesystem if they differ only on
135 executable bit.   On such an unfortunate filesystem, you may
136 need to use `git-update-index --chmod=`.
138 Author
139 ------
140 Written by Linus Torvalds <torvalds@osdl.org>
142 Documentation
143 --------------
144 Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
148 Part of the gitlink:git[7] suite