]>
Commit | Line | Data |
---|---|---|
215a7ad1 | 1 | git-update-index(1) |
2cf565c5 | 2 | =================== |
2cf565c5 DG |
3 | |
4 | NAME | |
5 | ---- | |
215a7ad1 | 6 | git-update-index - Modifies the index or directory cache |
2cf565c5 DG |
7 | |
8 | ||
9 | SYNOPSIS | |
10 | -------- | |
215a7ad1 | 11 | 'git-update-index' |
5773c9f2 | 12 | [--add] [--remove] [--unmerged] [--refresh] [--replace] |
2cf565c5 | 13 | [--cacheinfo <mode> <object> <file>]\* |
5773c9f2 | 14 | [--chmod=(+|-)x] |
df6e1516 | 15 | [--info-only] |
5773c9f2 JH |
16 | [--force-remove] |
17 | [--stdin] | |
18 | [--index-info] | |
19 | [--ignore-missing] | |
20 | [-z] | |
2cf565c5 DG |
21 | [--] [<file>]\* |
22 | ||
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. | |
28 | ||
215a7ad1 | 29 | The way "git-update-index" handles files it is told about can be modified |
2cf565c5 DG |
30 | using the various options: |
31 | ||
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. | |
38 | ||
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. | |
43 | ||
44 | --refresh:: | |
45 | Looks at the current cache and checks to see if merges or | |
46 | updates are needed by checking stat() information. | |
47 | ||
48 | --ignore-missing:: | |
49 | Ignores missing files during a --refresh | |
50 | ||
51 | --cacheinfo <mode> <object> <path>:: | |
52 | Directly insert the specified info into the cache. | |
53 | ||
df6e1516 BL |
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. | |
58 | ||
2cf565c5 DG |
59 | --force-remove:: |
60 | Remove the file from the index even when the working directory | |
9b63f501 | 61 | still has such a file. (Implies --remove.) |
2cf565c5 DG |
62 | |
63 | --replace:: | |
64 | By default, when a file `path` exists in the index, | |
215a7ad1 | 65 | git-update-index refuses an attempt to add `path/file`. |
2cf565c5 DG |
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. | |
70 | ||
1f7f99de JH |
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. | |
75 | ||
76 | -z:: | |
77 | Only meaningful with `--stdin`; paths are separated with | |
78 | NUL character instead of LF. | |
79 | ||
2cf565c5 DG |
80 | --:: |
81 | Do not interpret any more arguments as options. | |
82 | ||
83 | <file>:: | |
84 | Files to act on. | |
5773c9f2 | 85 | Note that files beginning with '.' are discarded. This includes |
2cf565c5 DG |
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 '//' | |
89 | ||
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. | |
97 | ||
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. | |
100 | ||
df6e1516 BL |
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. | |
106 | ||
df8baa42 | 107 | To pretend you have a file with mode and sha1 at path, say: |
2cf565c5 | 108 | |
215a7ad1 | 109 | $ git-update-index --cacheinfo mode sha1 path |
2cf565c5 | 110 | |
df6e1516 BL |
111 | '--info-only' is used to register files without placing them in the object |
112 | database. This is useful for status-only repositories. | |
2cf565c5 | 113 | |
df6e1516 BL |
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. | |
119 | ||
120 | Examples | |
121 | -------- | |
2cf565c5 DG |
122 | To update and refresh only the files already checked out: |
123 | ||
215a7ad1 | 124 | git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh |
2cf565c5 DG |
125 | |
126 | ||
5773c9f2 JH |
127 | Configuration |
128 | ------------- | |
129 | ||
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=`. | |
137 | ||
2cf565c5 DG |
138 | Author |
139 | ------ | |
140 | Written by Linus Torvalds <torvalds@osdl.org> | |
141 | ||
142 | Documentation | |
143 | -------------- | |
144 | Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>. | |
145 | ||
146 | GIT | |
147 | --- | |
a7154e91 | 148 | Part of the gitlink:git[7] suite |
2cf565c5 | 149 |