]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-update-index.txt
Add usage statement to git-checkout.sh
[thirdparty/git.git] / Documentation / git-update-index.txt
CommitLineData
215a7ad1 1git-update-index(1)
2cf565c5 2===================
2cf565c5
DG
3
4NAME
5----
215a7ad1 6git-update-index - Modifies the index or directory cache
2cf565c5
DG
7
8
9SYNOPSIS
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
23DESCRIPTION
24-----------
25Modifies the index or directory cache. Each file mentioned is updated
26into the cache and any 'unmerged' or 'needs updating' state is
27cleared.
28
215a7ad1 29The way "git-update-index" handles files it is told about can be modified
2cf565c5
DG
30using the various options:
31
32OPTIONS
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
90Using --refresh
91---------------
92'--refresh' does not calculate a new sha1 file or bring the cache
93up-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
95can refresh the cache for a file that hasn't been changed but where
96the stat entry is out of date.
97
98For example, you'd want to do this after doing a "git-read-tree", to link
99up the stat cache details with the proper files.
100
df6e1516
BL
101Using --cacheinfo or --info-only
102--------------------------------
103'--cacheinfo' is used to register a file that is not in the
104current working directory. This is useful for minimum-checkout
105merging.
106
df8baa42 107To 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
112database. This is useful for status-only repositories.
2cf565c5 113
df6e1516
BL
114Both '--cacheinfo' and '--info-only' behave similarly: the index is updated
115but the object database isn't. '--cacheinfo' is useful when the object is
116in the database but the file isn't available locally. '--info-only' is
117useful when the file is available, but you do not wish to update the
118object database.
119
120Examples
121--------
2cf565c5
DG
122To 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
127Configuration
128-------------
129
130The command honors `core.filemode` configuration variable. If
131your repository is on an filesystem whose executable bits are
132unreliable, this should be set to 'false'. This causes the
133command to ignore differences in file modes recorded in the
134index and the file mode on the filesystem if they differ only on
135executable bit. On such an unfortunate filesystem, you may
136need to use `git-update-index --chmod=`.
137
2cf565c5
DG
138Author
139------
140Written by Linus Torvalds <torvalds@osdl.org>
141
142Documentation
143--------------
144Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
145
146GIT
147---
a7154e91 148Part of the gitlink:git[7] suite
2cf565c5 149