1git-update-index(1) 2=================== 3 4NAME 5---- 6git-update-index - Modifies the index or directory cache 7 8 9SYNOPSIS 10-------- 11'git-update-index' 12 [--add] [--remove] [--unmerged] [--refresh] [--replace] 13 [--cacheinfo <mode> <object> <file>]\* 14 [--chmod=(+|-)x] 15 [--info-only] 16 [--force-remove] 17 [--stdin] 18 [--index-info] 19 [--ignore-missing] 20 [-z] 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 29The way "git-update-index" handles files it is told about can be modified 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 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 59--force-remove:: 60 Remove the file from the index even when the working directory 61 still has such a file. (Implies --remove.) 62 63--replace:: 64 By default, when a file `path` exists in the index, 65 git-update-index refuses an attempt to add `path/file`. 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 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 80--:: 81 Do not interpret any more arguments as options. 82 83<file>:: 84 Files to act on. 85 Note that files beginning with '.' are discarded. This includes 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 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 107To pretend you have a file with mode and sha1 at path, say: 108 109 $ git-update-index --cacheinfo mode sha1 path 110 111'--info-only' is used to register files without placing them in the object 112database. This is useful for status-only repositories. 113 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-------- 122To update and refresh only the files already checked out: 123 124 git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh 125 126 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 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--- 148Part of the gitlink:git[7] suite 149