]>
Commit | Line | Data |
---|---|---|
215a7ad1 | 1 | git-update-index(1) |
2cf565c5 | 2 | =================== |
2cf565c5 DG |
3 | |
4 | NAME | |
5 | ---- | |
c3f0baac | 6 | git-update-index - Register file contents in the working tree to the index |
2cf565c5 DG |
7 | |
8 | ||
9 | SYNOPSIS | |
10 | -------- | |
f9666adf | 11 | [verse] |
b1889c36 | 12 | 'git update-index' |
de5f2bf3 MK |
13 | [--add] [--remove | --force-remove] [--replace] |
14 | [--refresh] [-q] [--unmerged] [--ignore-missing] | |
ec160ae1 | 15 | [(--cacheinfo <mode>,<object>,<file>)...] |
5773c9f2 | 16 | [--chmod=(+|-)x] |
0460ed2c FC |
17 | [--[no-]assume-unchanged] |
18 | [--[no-]skip-worktree] | |
8dfb04ae | 19 | [--[no-]ignore-skip-worktree-entries] |
780494b1 | 20 | [--[no-]fsmonitor-valid] |
5fdeacb0 | 21 | [--ignore-submodules] |
bc497127 | 22 | [--[no-]split-index] |
eaab83d0 | 23 | [--[no-|test-|force-]untracked-cache] |
780494b1 | 24 | [--[no-]fsmonitor] |
7099c9c7 | 25 | [--really-refresh] [--unresolve] [--again | -g] |
14470c0d | 26 | [--info-only] [--index-info] |
69dec66b | 27 | [-z] [--stdin] [--index-version <n>] |
14470c0d | 28 | [--verbose] |
0adda936 | 29 | [--] [<file>...] |
2cf565c5 DG |
30 | |
31 | DESCRIPTION | |
32 | ----------- | |
33 | Modifies the index or directory cache. Each file mentioned is updated | |
5f3aa197 | 34 | into the index and any 'unmerged' or 'needs updating' state is |
2cf565c5 DG |
35 | cleared. |
36 | ||
5162e697 | 37 | See also linkgit:git-add[1] for a more user-friendly way to do some of |
e701ccc3 MM |
38 | the most common operations on the index. |
39 | ||
0b444cdb | 40 | The way 'git update-index' handles files it is told about can be modified |
2cf565c5 DG |
41 | using the various options: |
42 | ||
43 | OPTIONS | |
44 | ------- | |
45 | --add:: | |
5f3aa197 | 46 | If a specified file isn't in the index already then it's |
2cf565c5 DG |
47 | added. |
48 | Default behaviour is to ignore new files. | |
49 | ||
50 | --remove:: | |
5f3aa197 | 51 | If a specified file is in the index but is missing then it's |
2cf565c5 | 52 | removed. |
abda1ef5 | 53 | Default behavior is to ignore removed file. |
2cf565c5 DG |
54 | |
55 | --refresh:: | |
5f3aa197 | 56 | Looks at the current index and checks to see if merges or |
2cf565c5 DG |
57 | updates are needed by checking stat() information. |
58 | ||
14470c0d | 59 | -q:: |
5f3aa197 | 60 | Quiet. If --refresh finds that the index needs an update, the |
14470c0d | 61 | default behavior is to error out. This option makes |
0b444cdb | 62 | 'git update-index' continue anyway. |
14470c0d | 63 | |
04c8ce9c | 64 | --ignore-submodules:: |
5fdeacb0 JS |
65 | Do not try to update submodules. This option is only respected |
66 | when passed before --refresh. | |
67 | ||
14470c0d | 68 | --unmerged:: |
5f3aa197 | 69 | If --refresh finds unmerged changes in the index, the default |
0b444cdb | 70 | behavior is to error out. This option makes 'git update-index' |
14470c0d CS |
71 | continue anyway. |
72 | ||
2cf565c5 DG |
73 | --ignore-missing:: |
74 | Ignores missing files during a --refresh | |
75 | ||
ec160ae1 | 76 | --cacheinfo <mode>,<object>,<path>:: |
2cf565c5 | 77 | --cacheinfo <mode> <object> <path>:: |
ec160ae1 JH |
78 | Directly insert the specified info into the index. For |
79 | backward compatibility, you can also give these three | |
80 | arguments as three separate parameters, but new users are | |
81 | encouraged to use a single-parameter form. | |
a6080a0a | 82 | |
14470c0d | 83 | --index-info:: |
7acab8f1 | 84 | Read index information from stdin. |
14470c0d CS |
85 | |
86 | --chmod=(+|-)x:: | |
a6080a0a | 87 | Set the execute permissions on the updated files. |
14470c0d | 88 | |
0460ed2c | 89 | --[no-]assume-unchanged:: |
ccadb25f PO |
90 | When this flag is specified, the object names recorded |
91 | for the paths are not updated. Instead, this option | |
92 | sets/unsets the "assume unchanged" bit for the | |
93 | paths. When the "assume unchanged" bit is on, the user | |
94 | promises not to change the file and allows Git to assume | |
95 | that the working tree file matches what is recorded in | |
96 | the index. If you want to change the working tree file, | |
97 | you need to unset the bit to tell Git. This is | |
f9666adf JH |
98 | sometimes helpful when working with a big project on a |
99 | filesystem that has very slow lstat(2) system call | |
100 | (e.g. cifs). | |
6259ac66 | 101 | + |
6259ac66 PB |
102 | Git will fail (gracefully) in case it needs to modify this file |
103 | in the index e.g. when merging in a commit; | |
104 | thus, in case the assumed-untracked file is changed upstream, | |
105 | you will need to handle the situation manually. | |
f9666adf | 106 | |
466d1f15 | 107 | --really-refresh:: |
bcf9626a | 108 | Like `--refresh`, but checks stat information unconditionally, |
466d1f15 ŠN |
109 | without regard to the "assume unchanged" setting. |
110 | ||
0460ed2c | 111 | --[no-]skip-worktree:: |
44a36913 NTND |
112 | When one of these flags is specified, the object name recorded |
113 | for the paths are not updated. Instead, these options | |
114 | set and unset the "skip-worktree" bit for the paths. See | |
115 | section "Skip-worktree bit" below for more information. | |
116 | ||
8dfb04ae JS |
117 | |
118 | --[no-]ignore-skip-worktree-entries:: | |
119 | Do not remove skip-worktree (AKA "index-only") entries even when | |
120 | the `--remove` option was specified. | |
121 | ||
780494b1 BP |
122 | --[no-]fsmonitor-valid:: |
123 | When one of these flags is specified, the object name recorded | |
124 | for the paths are not updated. Instead, these options | |
125 | set and unset the "fsmonitor valid" bit for the paths. See | |
126 | section "File System Monitor" below for more information. | |
127 | ||
3240240f SB |
128 | -g:: |
129 | --again:: | |
0b444cdb | 130 | Runs 'git update-index' itself on the paths whose index |
83e77a25 JH |
131 | entries are different from those from the `HEAD` commit. |
132 | ||
060729dd MK |
133 | --unresolve:: |
134 | Restores the 'unmerged' or 'needs updating' state of a | |
135 | file during a merge if it was cleared by accident. | |
136 | ||
df6e1516 BL |
137 | --info-only:: |
138 | Do not create objects in the object database for all | |
139 | <file> arguments that follow this flag; just insert | |
5f3aa197 | 140 | their object IDs into the index. |
df6e1516 | 141 | |
2cf565c5 DG |
142 | --force-remove:: |
143 | Remove the file from the index even when the working directory | |
9b63f501 | 144 | still has such a file. (Implies --remove.) |
2cf565c5 DG |
145 | |
146 | --replace:: | |
147 | By default, when a file `path` exists in the index, | |
0b444cdb | 148 | 'git update-index' refuses an attempt to add `path/file`. |
2cf565c5 DG |
149 | Similarly if a file `path/file` exists, a file `path` |
150 | cannot be added. With --replace flag, existing entries | |
04c8ce9c | 151 | that conflict with the entry being added are |
2cf565c5 DG |
152 | automatically removed with warning messages. |
153 | ||
1f7f99de JH |
154 | --stdin:: |
155 | Instead of taking list of paths from the command line, | |
156 | read list of paths from the standard input. Paths are | |
157 | separated by LF (i.e. one path per line) by default. | |
158 | ||
14470c0d CS |
159 | --verbose:: |
160 | Report what is being added and removed from index. | |
161 | ||
69dec66b JH |
162 | --index-version <n>:: |
163 | Write the resulting index out in the named on-disk format version. | |
647d8794 NTND |
164 | Supported versions are 2, 3 and 4. The current default version is 2 |
165 | or 3, depending on whether extra features are used, such as | |
166 | `git add -N`. | |
167 | + | |
168 | Version 4 performs a simple pathname compression that reduces index | |
169 | size by 30%-50% on large repositories, which results in faster load | |
be94568b | 170 | time. Version 4 is relatively young (first released in 1.8.0 in |
647d8794 NTND |
171 | October 2012). Other Git implementations such as JGit and libgit2 |
172 | may not support it yet. | |
69dec66b | 173 | |
1f7f99de | 174 | -z:: |
537497be BW |
175 | Only meaningful with `--stdin` or `--index-info`; paths are |
176 | separated with NUL character instead of LF. | |
1f7f99de | 177 | |
c18b80a0 NTND |
178 | --split-index:: |
179 | --no-split-index:: | |
b4601395 CC |
180 | Enable or disable split index mode. If split-index mode is |
181 | already enabled and `--split-index` is given again, all | |
182 | changes in $GIT_DIR/index are pushed back to the shared index | |
183 | file. | |
13c0e4c4 CC |
184 | + |
185 | These options take effect whatever the value of the `core.splitIndex` | |
186 | configuration variable (see linkgit:git-config[1]). But a warning is | |
187 | emitted when the change goes against the configured value, as the | |
188 | configured value will take effect next time the index is read and this | |
189 | will remove the intended effect of the option. | |
c18b80a0 | 190 | |
9e597241 NTND |
191 | --untracked-cache:: |
192 | --no-untracked-cache:: | |
435ec090 CC |
193 | Enable or disable untracked cache feature. Please use |
194 | `--test-untracked-cache` before enabling it. | |
195 | + | |
196 | These options take effect whatever the value of the `core.untrackedCache` | |
197 | configuration variable (see linkgit:git-config[1]). But a warning is | |
198 | emitted when the change goes against the configured value, as the | |
199 | configured value will take effect next time the index is read and this | |
200 | will remove the intended effect of the option. | |
9e597241 | 201 | |
eaab83d0 CC |
202 | --test-untracked-cache:: |
203 | Only perform tests on the working directory to make sure | |
204 | untracked cache can be used. You have to manually enable | |
435ec090 CC |
205 | untracked cache using `--untracked-cache` or |
206 | `--force-untracked-cache` or the `core.untrackedCache` | |
207 | configuration variable afterwards if you really want to use | |
208 | it. If a test fails the exit code is 1 and a message | |
209 | explains what is not working as needed, otherwise the exit | |
210 | code is 0 and OK is printed. | |
eaab83d0 | 211 | |
f64cb88d | 212 | --force-untracked-cache:: |
435ec090 CC |
213 | Same as `--untracked-cache`. Provided for backwards |
214 | compatibility with older versions of Git where | |
215 | `--untracked-cache` used to imply `--test-untracked-cache` but | |
216 | this option would enable the extension unconditionally. | |
f64cb88d | 217 | |
780494b1 BP |
218 | --fsmonitor:: |
219 | --no-fsmonitor:: | |
220 | Enable or disable files system monitor feature. These options | |
221 | take effect whatever the value of the `core.fsmonitor` | |
222 | configuration variable (see linkgit:git-config[1]). But a warning | |
223 | is emitted when the change goes against the configured value, as | |
224 | the configured value will take effect next time the index is | |
225 | read and this will remove the intended effect of the option. | |
226 | ||
e994004f | 227 | \--:: |
2cf565c5 DG |
228 | Do not interpret any more arguments as options. |
229 | ||
230 | <file>:: | |
231 | Files to act on. | |
5773c9f2 | 232 | Note that files beginning with '.' are discarded. This includes |
a6080a0a | 233 | `./file` and `dir/./file`. If you don't want this, then use |
2cf565c5 DG |
234 | cleaner names. |
235 | The same applies to directories ending '/' and paths with '//' | |
236 | ||
76a8788c | 237 | USING --REFRESH |
2cf565c5 | 238 | --------------- |
bcf9626a | 239 | `--refresh` does not calculate a new sha1 file or bring the index |
7560f547 | 240 | up to date for mode/content changes. But what it *does* do is to |
5f3aa197 LS |
241 | "re-match" the stat information of a file with the index, so that you |
242 | can refresh the index for a file that hasn't been changed but where | |
2cf565c5 DG |
243 | the stat entry is out of date. |
244 | ||
0b444cdb | 245 | For example, you'd want to do this after doing a 'git read-tree', to link |
5f3aa197 | 246 | up the stat index details with the proper files. |
2cf565c5 | 247 | |
76a8788c | 248 | USING --CACHEINFO OR --INFO-ONLY |
df6e1516 | 249 | -------------------------------- |
bcf9626a | 250 | `--cacheinfo` is used to register a file that is not in the |
df6e1516 BL |
251 | current working directory. This is useful for minimum-checkout |
252 | merging. | |
253 | ||
388d0ff6 | 254 | To pretend you have a file at path with mode and sha1, say: |
2cf565c5 | 255 | |
61f693bd | 256 | ---------------- |
388d0ff6 | 257 | $ git update-index --add --cacheinfo <mode>,<sha1>,<path> |
61f693bd | 258 | ---------------- |
2cf565c5 | 259 | |
bcf9626a | 260 | `--info-only` is used to register files without placing them in the object |
df6e1516 | 261 | database. This is useful for status-only repositories. |
2cf565c5 | 262 | |
bcf9626a MM |
263 | Both `--cacheinfo` and `--info-only` behave similarly: the index is updated |
264 | but the object database isn't. `--cacheinfo` is useful when the object is | |
265 | in the database but the file isn't available locally. `--info-only` is | |
df6e1516 BL |
266 | useful when the file is available, but you do not wish to update the |
267 | object database. | |
268 | ||
d23748a6 | 269 | |
76a8788c | 270 | USING --INDEX-INFO |
d23748a6 JH |
271 | ------------------ |
272 | ||
273 | `--index-info` is a more powerful mechanism that lets you feed | |
274 | multiple entry definitions from the standard input, and designed | |
275 | specifically for scripts. It can take inputs of three formats: | |
276 | ||
d23748a6 JH |
277 | . mode SP type SP sha1 TAB path |
278 | + | |
e05aa688 | 279 | This format is to stuff `git ls-tree` output into the index. |
d23748a6 JH |
280 | |
281 | . mode SP sha1 SP stage TAB path | |
282 | + | |
283 | This format is to put higher order stages into the | |
0b444cdb | 284 | index file and matches 'git ls-files --stage' output. |
d23748a6 | 285 | |
e05aa688 JH |
286 | . mode SP sha1 TAB path |
287 | + | |
288 | This format is no longer produced by any Git command, but is | |
289 | and will continue to be supported by `update-index --index-info`. | |
290 | ||
d23748a6 JH |
291 | To place a higher stage entry to the index, the path should |
292 | first be removed by feeding a mode=0 entry for the path, and | |
293 | then feeding necessary input lines in the third format. | |
294 | ||
295 | For example, starting with this index: | |
296 | ||
297 | ------------ | |
298 | $ git ls-files -s | |
299 | 100644 8a1218a1024a212bb3db30becd860315f9f3ac52 0 frotz | |
300 | ------------ | |
301 | ||
302 | you can feed the following input to `--index-info`: | |
303 | ||
304 | ------------ | |
305 | $ git update-index --index-info | |
306 | 0 0000000000000000000000000000000000000000 frotz | |
307 | 100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1 frotz | |
308 | 100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2 frotz | |
309 | ------------ | |
310 | ||
311 | The first line of the input feeds 0 as the mode to remove the | |
d5fa1f1a | 312 | path; the SHA-1 does not matter as long as it is well formatted. |
d23748a6 JH |
313 | Then the second and third line feeds stage 1 and stage 2 entries |
314 | for that path. After the above, we would end up with this: | |
315 | ||
316 | ------------ | |
317 | $ git ls-files -s | |
318 | 100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1 frotz | |
319 | 100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2 frotz | |
320 | ------------ | |
321 | ||
322 | ||
76a8788c | 323 | USING ``ASSUME UNCHANGED'' BIT |
bae777db | 324 | ------------------------------ |
f9666adf | 325 | |
2de9b711 | 326 | Many operations in Git depend on your filesystem to have an |
f9666adf JH |
327 | efficient `lstat(2)` implementation, so that `st_mtime` |
328 | information for working tree files can be cheaply checked to see | |
329 | if the file contents have changed from the version recorded in | |
330 | the index file. Unfortunately, some filesystems have | |
331 | inefficient `lstat(2)`. If your filesystem is one of them, you | |
332 | can set "assume unchanged" bit to paths you have not changed to | |
2de9b711 TA |
333 | cause Git not to do this check. Note that setting this bit on a |
334 | path does not mean Git will check the contents of the file to | |
335 | see if it has changed -- it makes Git to omit any checking and | |
f9666adf | 336 | assume it has *not* changed. When you make changes to working |
2de9b711 | 337 | tree files, you have to explicitly tell Git about it by dropping |
f9666adf JH |
338 | "assume unchanged" bit, either before or after you modify them. |
339 | ||
340 | In order to set "assume unchanged" bit, use `--assume-unchanged` | |
acd6d7e7 SN |
341 | option. To unset, use `--no-assume-unchanged`. To see which files |
342 | have the "assume unchanged" bit set, use `git ls-files -v` | |
343 | (see linkgit:git-ls-files[1]). | |
f9666adf JH |
344 | |
345 | The command looks at `core.ignorestat` configuration variable. When | |
b1889c36 | 346 | this is true, paths updated with `git update-index paths...` and |
2de9b711 | 347 | paths updated with other Git commands that update both index and |
0b444cdb TR |
348 | working tree (e.g. 'git apply --index', 'git checkout-index -u', |
349 | and 'git read-tree -u') are automatically marked as "assume | |
f9666adf | 350 | unchanged". Note that "assume unchanged" bit is *not* set if |
b1889c36 JN |
351 | `git update-index --refresh` finds the working tree file matches |
352 | the index (use `git update-index --really-refresh` if you want | |
f9666adf JH |
353 | to mark them as "assume unchanged"). |
354 | ||
355 | ||
76a8788c | 356 | EXAMPLES |
df6e1516 | 357 | -------- |
2cf565c5 DG |
358 | To update and refresh only the files already checked out: |
359 | ||
61f693bd | 360 | ---------------- |
b1889c36 | 361 | $ git checkout-index -n -f -a && git update-index --ignore-missing --refresh |
61f693bd | 362 | ---------------- |
2cf565c5 | 363 | |
48aeecdc SE |
364 | On an inefficient filesystem with `core.ignorestat` set:: |
365 | + | |
f9666adf | 366 | ------------ |
48aeecdc SE |
367 | $ git update-index --really-refresh <1> |
368 | $ git update-index --no-assume-unchanged foo.c <2> | |
369 | $ git diff --name-only <3> | |
f9666adf | 370 | $ edit foo.c |
48aeecdc | 371 | $ git diff --name-only <4> |
f9666adf | 372 | M foo.c |
48aeecdc SE |
373 | $ git update-index foo.c <5> |
374 | $ git diff --name-only <6> | |
f9666adf | 375 | $ edit foo.c |
48aeecdc SE |
376 | $ git diff --name-only <7> |
377 | $ git update-index --no-assume-unchanged foo.c <8> | |
378 | $ git diff --name-only <9> | |
f9666adf | 379 | M foo.c |
48aeecdc SE |
380 | ------------ |
381 | + | |
382 | <1> forces lstat(2) to set "assume unchanged" bits for paths that match index. | |
f9666adf JH |
383 | <2> mark the path to be edited. |
384 | <3> this does lstat(2) and finds index matches the path. | |
48aeecdc | 385 | <4> this does lstat(2) and finds index does *not* match the path. |
f9666adf JH |
386 | <5> registering the new version to index sets "assume unchanged" bit. |
387 | <6> and it is assumed unchanged. | |
388 | <7> even after you edit it. | |
389 | <8> you can tell about the change after the fact. | |
390 | <9> now it checks with lstat(2) and finds it has been changed. | |
f9666adf | 391 | |
2cf565c5 | 392 | |
76a8788c | 393 | SKIP-WORKTREE BIT |
44a36913 NTND |
394 | ----------------- |
395 | ||
396 | Skip-worktree bit can be defined in one (long) sentence: When reading | |
397 | an entry, if it is marked as skip-worktree, then Git pretends its | |
398 | working directory version is up to date and read the index version | |
399 | instead. | |
400 | ||
401 | To elaborate, "reading" means checking for file existence, reading | |
402 | file attributes or file content. The working directory version may be | |
403 | present or absent. If present, its content may match against the index | |
404 | version or not. Writing is not affected by this bit, content safety | |
405 | is still first priority. Note that Git _can_ update working directory | |
406 | file, that is marked skip-worktree, if it is safe to do so (i.e. | |
407 | working directory version matches index version) | |
408 | ||
409 | Although this bit looks similar to assume-unchanged bit, its goal is | |
410 | different from assume-unchanged bit's. Skip-worktree also takes | |
411 | precedence over assume-unchanged bit when both are set. | |
412 | ||
76a8788c | 413 | SPLIT INDEX |
b4601395 CC |
414 | ----------- |
415 | ||
416 | This mode is designed for repositories with very large indexes, and | |
417 | aims at reducing the time it takes to repeatedly write these indexes. | |
418 | ||
419 | In this mode, the index is split into two files, $GIT_DIR/index and | |
420 | $GIT_DIR/sharedindex.<SHA-1>. Changes are accumulated in | |
421 | $GIT_DIR/index, the split index, while the shared index file contains | |
422 | all index entries and stays unchanged. | |
423 | ||
424 | All changes in the split index are pushed back to the shared index | |
425 | file when the number of entries in the split index reaches a level | |
426 | specified by the splitIndex.maxPercentChange config variable (see | |
427 | linkgit:git-config[1]). | |
428 | ||
429 | Each time a new shared index file is created, the old shared index | |
430 | files are deleted if their modification time is older than what is | |
431 | specified by the splitIndex.sharedIndexExpire config variable (see | |
432 | linkgit:git-config[1]). | |
433 | ||
434 | To avoid deleting a shared index file that is still used, its | |
435 | modification time is updated to the current time everytime a new split | |
436 | index based on the shared index file is either created or read from. | |
437 | ||
76a8788c | 438 | UNTRACKED CACHE |
435ec090 CC |
439 | --------------- |
440 | ||
441 | This cache is meant to speed up commands that involve determining | |
442 | untracked files such as `git status`. | |
443 | ||
444 | This feature works by recording the mtime of the working tree | |
445 | directories and then omitting reading directories and stat calls | |
446 | against files in those directories whose mtime hasn't changed. For | |
447 | this to work the underlying operating system and file system must | |
448 | change the `st_mtime` field of directories if files in the directory | |
449 | are added, modified or deleted. | |
450 | ||
451 | You can test whether the filesystem supports that with the | |
452 | `--test-untracked-cache` option. The `--untracked-cache` option used | |
453 | to implicitly perform that test in older versions of Git, but that's | |
454 | no longer the case. | |
455 | ||
456 | If you want to enable (or disable) this feature, it is easier to use | |
457 | the `core.untrackedCache` configuration variable (see | |
458 | linkgit:git-config[1]) than using the `--untracked-cache` option to | |
459 | `git update-index` in each repository, especially if you want to do so | |
460 | across all repositories you use, because you can set the configuration | |
461 | variable to `true` (or `false`) in your `$HOME/.gitconfig` just once | |
462 | and have it affect all repositories you touch. | |
463 | ||
464 | When the `core.untrackedCache` configuration variable is changed, the | |
465 | untracked cache is added to or removed from the index the next time a | |
466 | command reads the index; while when `--[no-|force-]untracked-cache` | |
467 | are used, the untracked cache is immediately added to or removed from | |
468 | the index. | |
44a36913 | 469 | |
9b978691 ÆAB |
470 | Before 2.17, the untracked cache had a bug where replacing a directory |
471 | with a symlink to another directory could cause it to incorrectly show | |
472 | files tracked by git as untracked. See the "status: add a failing test | |
473 | showing a core.untrackedCache bug" commit to git.git. A workaround for | |
474 | that is (and this might work for other undiscovered bugs in the | |
475 | future): | |
476 | ||
477 | ---------------- | |
478 | $ git -c core.untrackedCache=false status | |
479 | ---------------- | |
480 | ||
481 | This bug has also been shown to affect non-symlink cases of replacing | |
482 | a directory with a file when it comes to the internal structures of | |
483 | the untracked cache, but no case has been reported where this resulted in | |
484 | wrong "git status" output. | |
485 | ||
7bf0be75 ÆAB |
486 | There are also cases where existing indexes written by git versions |
487 | before 2.17 will reference directories that don't exist anymore, | |
488 | potentially causing many "could not open directory" warnings to be | |
489 | printed on "git status". These are new warnings for existing issues | |
490 | that were previously silently discarded. | |
491 | ||
492 | As with the bug described above the solution is to one-off do a "git | |
493 | status" run with `core.untrackedCache=false` to flush out the leftover | |
494 | bad data. | |
495 | ||
76a8788c | 496 | FILE SYSTEM MONITOR |
780494b1 BP |
497 | ------------------- |
498 | ||
499 | This feature is intended to speed up git operations for repos that have | |
500 | large working directories. | |
501 | ||
502 | It enables git to work together with a file system monitor (see the | |
503 | "fsmonitor-watchman" section of linkgit:githooks[5]) that can | |
504 | inform it as to what files have been modified. This enables git to avoid | |
505 | having to lstat() every file to find modified files. | |
506 | ||
507 | When used in conjunction with the untracked cache, it can further improve | |
508 | performance by avoiding the cost of scanning the entire working directory | |
509 | looking for new files. | |
510 | ||
511 | If you want to enable (or disable) this feature, it is easier to use | |
512 | the `core.fsmonitor` configuration variable (see | |
513 | linkgit:git-config[1]) than using the `--fsmonitor` option to | |
514 | `git update-index` in each repository, especially if you want to do so | |
515 | across all repositories you use, because you can set the configuration | |
4ccf461f BP |
516 | variable in your `$HOME/.gitconfig` just once and have it affect all |
517 | repositories you touch. | |
780494b1 BP |
518 | |
519 | When the `core.fsmonitor` configuration variable is changed, the | |
520 | file system monitor is added to or removed from the index the next time | |
521 | a command reads the index. When `--[no-]fsmonitor` are used, the file | |
522 | system monitor is immediately added to or removed from the index. | |
523 | ||
76a8788c | 524 | CONFIGURATION |
5773c9f2 JH |
525 | ------------- |
526 | ||
527 | The command honors `core.filemode` configuration variable. If | |
466d1f15 | 528 | your repository is on a filesystem whose executable bits are |
5162e697 | 529 | unreliable, this should be set to 'false' (see linkgit:git-config[1]). |
61f693bd JL |
530 | This causes the command to ignore differences in file modes recorded |
531 | in the index and the file mode on the filesystem if they differ only on | |
5773c9f2 | 532 | executable bit. On such an unfortunate filesystem, you may |
0b444cdb | 533 | need to use 'git update-index --chmod='. |
5773c9f2 | 534 | |
78a8d641 | 535 | Quite similarly, if `core.symlinks` configuration variable is set |
5162e697 | 536 | to 'false' (see linkgit:git-config[1]), symbolic links are checked out |
78a8d641 JS |
537 | as plain files, and this command does not modify a recorded file mode |
538 | from symbolic link to regular file. | |
539 | ||
f9666adf JH |
540 | The command looks at `core.ignorestat` configuration variable. See |
541 | 'Using "assume unchanged" bit' section above. | |
542 | ||
1ce4790b AR |
543 | The command also looks at `core.trustctime` configuration variable. |
544 | It can be useful when the inode change time is regularly modified by | |
545 | something outside Git (file system crawlers and backup systems use | |
546 | ctime for marking files processed) (see linkgit:git-config[1]). | |
547 | ||
435ec090 CC |
548 | The untracked cache extension can be enabled by the |
549 | `core.untrackedCache` configuration variable (see | |
550 | linkgit:git-config[1]). | |
61f693bd | 551 | |
56ae8df5 | 552 | SEE ALSO |
61f693bd | 553 | -------- |
5162e697 | 554 | linkgit:git-config[1], |
acd6d7e7 SN |
555 | linkgit:git-add[1], |
556 | linkgit:git-ls-files[1] | |
61f693bd | 557 | |
2cf565c5 DG |
558 | GIT |
559 | --- | |
9e1f0a85 | 560 | Part of the linkgit:git[1] suite |