6 git-update-index - Modifies the index or directory cache
12 [--add] [--remove] [--refresh] [--replace]
15 [--cacheinfo <mode> <object> <file>]\*
22 Modifies the index or directory cache. Each file mentioned is updated
23 into the cache and any 'unmerged' or 'needs updating' state is
26 The way "git-update-index" handles files it is told about can be modified
27 using the various options:
32 If a specified file isn't in the cache already then it's
34 Default behaviour is to ignore new files.
37 If a specified file is in the cache but is missing then it's
39 Default behaviour is to ignore removed file.
42 Looks at the current cache and checks to see if merges or
43 updates are needed by checking stat() information.
46 Ignores missing files during a --refresh
48 --cacheinfo <mode> <object> <path>::
49 Directly insert the specified info into the cache.
52 Do not create objects in the object database for all
53 <file> arguments that follow this flag; just insert
54 their object IDs into the cache.
57 Remove the file from the index even when the working directory
58 still has such a file. (Implies --remove.)
61 By default, when a file `path` exists in the index,
62 git-update-index refuses an attempt to add `path/file`.
63 Similarly if a file `path/file` exists, a file `path`
64 cannot be added. With --replace flag, existing entries
65 that conflicts with the entry being added are
66 automatically removed with warning messages.
69 Instead of taking list of paths from the command line,
70 read list of paths from the standard input. Paths are
71 separated by LF (i.e. one path per line) by default.
74 Only meaningful with `--stdin`; paths are separated with
75 NUL character instead of LF.
78 Do not interpret any more arguments as options.
82 Note that files begining with '.' are discarded. This includes
83 `./file` and `dir/./file`. If you don't want this, then use
85 The same applies to directories ending '/' and paths with '//'
89 '--refresh' does not calculate a new sha1 file or bring the cache
90 up-to-date for mode/content changes. But what it *does* do is to
91 "re-match" the stat information of a file with the cache, so that you
92 can refresh the cache for a file that hasn't been changed but where
93 the stat entry is out of date.
95 For example, you'd want to do this after doing a "git-read-tree", to link
96 up the stat cache details with the proper files.
98 Using --cacheinfo or --info-only
99 --------------------------------
100 '--cacheinfo' is used to register a file that is not in the
101 current working directory. This is useful for minimum-checkout
104 To pretend you have a file with mode and sha1 at path, say:
106 $ git-update-index --cacheinfo mode sha1 path
108 '--info-only' is used to register files without placing them in the object
109 database. This is useful for status-only repositories.
111 Both '--cacheinfo' and '--info-only' behave similarly: the index is updated
112 but the object database isn't. '--cacheinfo' is useful when the object is
113 in the database but the file isn't available locally. '--info-only' is
114 useful when the file is available, but you do not wish to update the
119 To update and refresh only the files already checked out:
121 git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh
126 Written by Linus Torvalds <torvalds@osdl.org>
130 Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
134 Part of the gitlink:git[7] suite