]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-update-index.txt
update-index: --stdin and -z
[thirdparty/git.git] / Documentation / git-update-index.txt
CommitLineData
215a7ad1 1git-update-index(1)
2cf565c5
DG
2===================
3v0.1, May 2005
4
5NAME
6----
215a7ad1 7git-update-index - Modifies the index or directory cache
2cf565c5
DG
8
9
10SYNOPSIS
11--------
215a7ad1 12'git-update-index'
2cf565c5
DG
13 [--add] [--remove] [--refresh] [--replace]
14 [--ignore-missing]
9b63f501 15 [--force-remove]
2cf565c5 16 [--cacheinfo <mode> <object> <file>]\*
df6e1516 17 [--info-only]
2cf565c5
DG
18 [--] [<file>]\*
19
20DESCRIPTION
21-----------
22Modifies the index or directory cache. Each file mentioned is updated
23into the cache and any 'unmerged' or 'needs updating' state is
24cleared.
25
215a7ad1 26The way "git-update-index" handles files it is told about can be modified
2cf565c5
DG
27using the various options:
28
29OPTIONS
30-------
31--add::
32 If a specified file isn't in the cache already then it's
33 added.
34 Default behaviour is to ignore new files.
35
36--remove::
37 If a specified file is in the cache but is missing then it's
38 removed.
39 Default behaviour is to ignore removed file.
40
41--refresh::
42 Looks at the current cache and checks to see if merges or
43 updates are needed by checking stat() information.
44
45--ignore-missing::
46 Ignores missing files during a --refresh
47
48--cacheinfo <mode> <object> <path>::
49 Directly insert the specified info into the cache.
50
df6e1516
BL
51--info-only::
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.
55
2cf565c5
DG
56--force-remove::
57 Remove the file from the index even when the working directory
9b63f501 58 still has such a file. (Implies --remove.)
2cf565c5
DG
59
60--replace::
61 By default, when a file `path` exists in the index,
215a7ad1 62 git-update-index refuses an attempt to add `path/file`.
2cf565c5
DG
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.
67
68--::
69 Do not interpret any more arguments as options.
70
71<file>::
72 Files to act on.
73 Note that files begining with '.' are discarded. This includes
74 `./file` and `dir/./file`. If you don't want this, then use
75 cleaner names.
76 The same applies to directories ending '/' and paths with '//'
77
78Using --refresh
79---------------
80'--refresh' does not calculate a new sha1 file or bring the cache
81up-to-date for mode/content changes. But what it *does* do is to
82"re-match" the stat information of a file with the cache, so that you
83can refresh the cache for a file that hasn't been changed but where
84the stat entry is out of date.
85
86For example, you'd want to do this after doing a "git-read-tree", to link
87up the stat cache details with the proper files.
88
df6e1516
BL
89Using --cacheinfo or --info-only
90--------------------------------
91'--cacheinfo' is used to register a file that is not in the
92current working directory. This is useful for minimum-checkout
93merging.
94
95 To pretend you have a file with mode and sha1 at path, say:
2cf565c5 96
215a7ad1 97 $ git-update-index --cacheinfo mode sha1 path
2cf565c5 98
df6e1516
BL
99'--info-only' is used to register files without placing them in the object
100database. This is useful for status-only repositories.
2cf565c5 101
df6e1516
BL
102Both '--cacheinfo' and '--info-only' behave similarly: the index is updated
103but the object database isn't. '--cacheinfo' is useful when the object is
104in the database but the file isn't available locally. '--info-only' is
105useful when the file is available, but you do not wish to update the
106object database.
107
108Examples
109--------
2cf565c5
DG
110To update and refresh only the files already checked out:
111
215a7ad1 112 git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh
2cf565c5
DG
113
114
115Author
116------
117Written by Linus Torvalds <torvalds@osdl.org>
118
119Documentation
120--------------
121Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
122
123GIT
124---
a7154e91 125Part of the gitlink:git[7] suite
2cf565c5 126