diff options
author | Junio C Hamano <junkio@cox.net> | 2006-12-25 03:11:00 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-12-25 03:29:08 -0800 |
commit | 9f95069beb507f496c8d3005defbaa27318f5347 (patch) | |
tree | 564e4455799c64ff93c62335ef6c8b96596dd566 /t | |
parent | match_pathspec() -- return how well the spec matched (diff) | |
download | tgif-9f95069beb507f496c8d3005defbaa27318f5347.tar.xz |
git-rm: update to saner semantics
This updates the "git rm" command with saner semantics suggested
on the list earlier with:
Message-ID: <Pine.LNX.4.64.0612020919400.3476@woody.osdl.org>
Message-ID: <Pine.LNX.4.64.0612040737120.3476@woody.osdl.org>
The command still validates that the given paths all talk about
sensible paths to avoid mistakes (e.g. "git rm fiel" when file
"fiel" does not exist would error out -- user meant to remove
"file"), and it has further safety checks described next. The
biggest difference is that the paths are removed from both index
and from the working tree (if you have an exotic need to remove
paths only from the index, you can use the --cached option).
The command refuses to remove if the copy on the working tree
does not match the index, or if the index and the HEAD does not
match. You can defeat this check with -f option.
This safety check has two exceptions: if the working tree file
does not exist to begin with, that technically does not match
the index but it is allowed. This is to allow this CVS style
command sequence:
rm <path> && git rm <path>
Also if the index is unmerged at the <path>, you can use "git rm
<path>" to declare that the result of the merge loses that path,
and the above safety check does not trigger; requiring the file
to match the index in this case forces the user to do "git
update-index file && git rm file", which is just crazy.
To recursively remove all contents from a directory, you need to
pass -r option, not just the directory name as the <path>.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 't')
0 files changed, 0 insertions, 0 deletions