[PATCH] possible memory leak in diff.c::diff_free_filepair()
[git.git] / Documentation / git-update-cache.txt
blob7340e89c1fe2d0f93d7ed7499e9d1536f05620ad
1 git-update-cache(1)
2 ===================
3 v0.1, May 2005
5 NAME
6 ----
7 git-update-cache - Modifies the index or directory cache
10 SYNOPSIS
11 --------
12 'git-update-cache'
13              [--add] [--remove] [--refresh] [--replace]
14              [--ignore-missing]
15              [--force-remove]
16              [--cacheinfo <mode> <object> <file>]\*
17              [--info-only]
18              [--] [<file>]\*
20 DESCRIPTION
21 -----------
22 Modifies the index or directory cache. Each file mentioned is updated
23 into the cache and any 'unmerged' or 'needs updating' state is
24 cleared.
26 The way "git-update-cache" handles files it is told about can be modified
27 using the various options:
29 OPTIONS
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.
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.
41 --refresh::
42         Looks at the current cache and checks to see if merges or
43         updates are needed by checking stat() information.
45 --ignore-missing::
46         Ignores missing files during a --refresh
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.
56 --force-remove::
57         Remove the file from the index even when the working directory
58         still has such a file. (Implies --remove.)
60 --replace::
61         By default, when a file `path` exists in the index,
62         git-update-cache 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.
68 --::
69         Do not interpret any more arguments as options.
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 '//'
78 Using --refresh
79 ---------------
80 '--refresh' does not calculate a new sha1 file or bring the cache
81 up-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
83 can refresh the cache for a file that hasn't been changed but where
84 the stat entry is out of date.
86 For example, you'd want to do this after doing a "git-read-tree", to link
87 up the stat cache details with the proper files.
89 Using --cacheinfo or --info-only
90 --------------------------------
91 '--cacheinfo' is used to register a file that is not in the
92 current working directory.  This is useful for minimum-checkout
93 merging.
95   To pretend you have a file with mode and sha1 at path, say:
97    $ git-update-cache --cacheinfo mode sha1 path
99 '--info-only' is used to register files without placing them in the object
100 database.  This is useful for status-only repositories.
102 Both '--cacheinfo' and '--info-only' behave similarly: the index is updated
103 but the object database isn't.  '--cacheinfo' is useful when the object is
104 in the database but the file isn't available locally.  '--info-only' is
105 useful when the file is available, but you do not wish to update the
106 object database.
108 Examples
109 --------
110 To update and refresh only the files already checked out:
112    git-checkout-cache -n -f -a && git-update-cache --ignore-missing --refresh
115 Author
116 ------
117 Written by Linus Torvalds <torvalds@osdl.org>
119 Documentation
120 --------------
121 Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
125 Part of the link:git.html[git] suite