2005-09-08 02:26:23 +02:00
|
|
|
git-checkout-index(1)
|
2005-05-10 23:32:30 +02:00
|
|
|
=====================
|
|
|
|
v0.1, May 2005
|
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
2005-09-08 02:26:23 +02:00
|
|
|
git-checkout-index - Copy files from the cache to the working directory
|
2005-05-10 23:32:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
2005-09-08 02:26:23 +02:00
|
|
|
'git-checkout-index' [-u] [-q] [-a] [-f] [-n] [--prefix=<string>]
|
2005-05-10 23:32:30 +02:00
|
|
|
[--] <file>...
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
|
|
|
Will copy all files listed from the cache to the working directory
|
|
|
|
(not overwriting existing files).
|
|
|
|
|
|
|
|
OPTIONS
|
|
|
|
-------
|
2005-05-15 23:23:12 +02:00
|
|
|
-u::
|
|
|
|
update stat information for the checked out entries in
|
|
|
|
the cache file.
|
|
|
|
|
2005-05-10 23:32:30 +02:00
|
|
|
-q::
|
|
|
|
be quiet if files exist or are not in the cache
|
|
|
|
|
|
|
|
-f::
|
|
|
|
forces overwrite of existing files
|
|
|
|
|
|
|
|
-a::
|
|
|
|
checks out all files in the cache (will then continue to
|
|
|
|
process listed files).
|
|
|
|
|
|
|
|
-n::
|
|
|
|
Don't checkout new files, only refresh files already checked
|
|
|
|
out.
|
|
|
|
|
|
|
|
--prefix=<string>::
|
|
|
|
When creating files, prepend <string> (usually a directory
|
|
|
|
including a trailing /)
|
|
|
|
|
|
|
|
--::
|
|
|
|
Do not interpret any more arguments as options.
|
|
|
|
|
|
|
|
Note that the order of the flags matters:
|
|
|
|
|
2005-09-08 02:26:23 +02:00
|
|
|
git-checkout-index -a -f file.c
|
2005-05-10 23:32:30 +02:00
|
|
|
|
|
|
|
will first check out all files listed in the cache (but not overwrite
|
|
|
|
any old ones), and then force-checkout `file.c` a second time (ie that
|
|
|
|
one *will* overwrite any old contents with the same filename).
|
|
|
|
|
2005-09-08 02:26:23 +02:00
|
|
|
Also, just doing "git-checkout-index" does nothing. You probably meant
|
|
|
|
"git-checkout-index -a". And if you want to force it, you want
|
|
|
|
"git-checkout-index -f -a".
|
2005-05-10 23:32:30 +02:00
|
|
|
|
|
|
|
Intuitiveness is not the goal here. Repeatability is. The reason for
|
|
|
|
the "no arguments means no work" thing is that from scripts you are
|
|
|
|
supposed to be able to do things like:
|
|
|
|
|
2005-09-08 02:26:23 +02:00
|
|
|
find . -name '*.h' -print0 | xargs -0 git-checkout-index -f --
|
2005-05-10 23:32:30 +02:00
|
|
|
|
|
|
|
which will force all existing `*.h` files to be replaced with their
|
|
|
|
cached copies. If an empty command line implied "all", then this would
|
|
|
|
force-refresh everything in the cache, which was not the point.
|
|
|
|
|
|
|
|
To update and refresh only the files already checked out:
|
|
|
|
|
2005-09-08 02:26:23 +02:00
|
|
|
git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh
|
2005-05-10 23:32:30 +02:00
|
|
|
|
|
|
|
Oh, and the "--" is just a good idea when you know the rest will be
|
|
|
|
filenames. Just so that you wouldn't have a filename of "-a" causing
|
|
|
|
problems (not possible in the above example, but get used to it in
|
|
|
|
scripting!).
|
|
|
|
|
|
|
|
The prefix ability basically makes it trivial to use
|
2005-09-08 02:26:23 +02:00
|
|
|
git-checkout-index as an "export as tree" function. Just read the
|
2005-05-10 23:32:30 +02:00
|
|
|
desired tree into the index, and do a
|
|
|
|
|
2005-09-08 02:26:23 +02:00
|
|
|
git-checkout-index --prefix=git-export-dir/ -a
|
2005-05-10 23:32:30 +02:00
|
|
|
|
2005-09-08 02:26:23 +02:00
|
|
|
and git-checkout-index will "export" the cache into the specified
|
2005-05-10 23:32:30 +02:00
|
|
|
directory.
|
|
|
|
|
|
|
|
NOTE The final "/" is important. The exported name is literally just
|
|
|
|
prefixed with the specified string, so you can also do something like
|
|
|
|
|
2005-09-08 02:26:23 +02:00
|
|
|
git-checkout-index --prefix=.merged- Makefile
|
2005-05-10 23:32:30 +02:00
|
|
|
|
|
|
|
to check out the currently cached copy of `Makefile` into the file
|
|
|
|
`.merged-Makefile`
|
|
|
|
|
|
|
|
Author
|
|
|
|
------
|
|
|
|
Written by Linus Torvalds <torvalds@osdl.org>
|
|
|
|
|
|
|
|
Documentation
|
|
|
|
--------------
|
|
|
|
Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
|
|
|
|
|
|
|
|
GIT
|
|
|
|
---
|
|
|
|
Part of the link:git.html[git] suite
|
|
|
|
|