You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
2.9 KiB
107 lines
2.9 KiB
19 years ago
|
git-checkout-index(1)
|
||
20 years ago
|
=====================
|
||
|
v0.1, May 2005
|
||
|
|
||
|
NAME
|
||
|
----
|
||
19 years ago
|
git-checkout-index - Copy files from the cache to the working directory
|
||
20 years ago
|
|
||
|
|
||
|
SYNOPSIS
|
||
|
--------
|
||
19 years ago
|
'git-checkout-index' [-u] [-q] [-a] [-f] [-n] [--prefix=<string>]
|
||
20 years ago
|
[--] <file>...
|
||
|
|
||
|
DESCRIPTION
|
||
|
-----------
|
||
|
Will copy all files listed from the cache to the working directory
|
||
|
(not overwriting existing files).
|
||
|
|
||
|
OPTIONS
|
||
|
-------
|
||
20 years ago
|
-u::
|
||
|
update stat information for the checked out entries in
|
||
|
the cache file.
|
||
|
|
||
20 years ago
|
-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:
|
||
|
|
||
19 years ago
|
git-checkout-index -a -f file.c
|
||
20 years ago
|
|
||
|
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).
|
||
|
|
||
19 years ago
|
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".
|
||
20 years ago
|
|
||
|
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:
|
||
|
|
||
19 years ago
|
find . -name '*.h' -print0 | xargs -0 git-checkout-index -f --
|
||
20 years ago
|
|
||
|
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:
|
||
|
|
||
19 years ago
|
git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh
|
||
20 years ago
|
|
||
|
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
|
||
19 years ago
|
git-checkout-index as an "export as tree" function. Just read the
|
||
20 years ago
|
desired tree into the index, and do a
|
||
|
|
||
19 years ago
|
git-checkout-index --prefix=git-export-dir/ -a
|
||
20 years ago
|
|
||
19 years ago
|
and git-checkout-index will "export" the cache into the specified
|
||
20 years ago
|
directory.
|
||
|
|
||
|
NOTE The final "/" is important. The exported name is literally just
|
||
|
prefixed with the specified string, so you can also do something like
|
||
|
|
||
19 years ago
|
git-checkout-index --prefix=.merged- Makefile
|
||
20 years ago
|
|
||
|
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
|
||
|
|