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] [--refresh] [--replace] 13 [--ignore-missing] 14 [--force-remove] 15 [--cacheinfo <mode> <object> <file>]\* 16 [--info-only] 17 [-z] [--stdin] 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 26The way "git-update-index" handles files it is told about can be modified 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 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 56--force-remove:: 57 Remove the file from the index even when the working directory 58 still has such a file. (Implies --remove.) 59 60--replace:: 61 By default, when a file `path` exists in the index, 62 git-update-index refuses an attempt to add `path/file`. 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--stdin:: 69 Instead of taking list of paths from the command line, 70 read list of paths from the standard input. Paths are 71 separated by LF (i.e. one path per line) by default. 72 73-z:: 74 Only meaningful with `--stdin`; paths are separated with 75 NUL character instead of LF. 76 77--:: 78 Do not interpret any more arguments as options. 79 80<file>:: 81 Files to act on. 82 Note that files begining with '.' are discarded. This includes 83 `./file` and `dir/./file`. If you don't want this, then use 84 cleaner names. 85 The same applies to directories ending '/' and paths with '//' 86 87Using --refresh 88--------------- 89'--refresh' does not calculate a new sha1 file or bring the cache 90up-to-date for mode/content changes. But what it *does* do is to 91"re-match" the stat information of a file with the cache, so that you 92can refresh the cache for a file that hasn't been changed but where 93the stat entry is out of date. 94 95For example, you'd want to do this after doing a "git-read-tree", to link 96up the stat cache details with the proper files. 97 98Using --cacheinfo or --info-only 99-------------------------------- 100'--cacheinfo' is used to register a file that is not in the 101current working directory. This is useful for minimum-checkout 102merging. 103 104 To pretend you have a file with mode and sha1 at path, say: 105 106 $ git-update-index --cacheinfo mode sha1 path 107 108'--info-only' is used to register files without placing them in the object 109database. This is useful for status-only repositories. 110 111Both '--cacheinfo' and '--info-only' behave similarly: the index is updated 112but the object database isn't. '--cacheinfo' is useful when the object is 113in the database but the file isn't available locally. '--info-only' is 114useful when the file is available, but you do not wish to update the 115object database. 116 117Examples 118-------- 119To update and refresh only the files already checked out: 120 121 git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh 122 123 124Author 125------ 126Written by Linus Torvalds <torvalds@osdl.org> 127 128Documentation 129-------------- 130Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>. 131 132GIT 133--- 134Part of the gitlink:git[7] suite 135