Re: On removing files and "git-rm is pointless"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, 4 Dec 2006, Junio C Hamano wrote:
> 
> FWIW, I too am in favor of the proposed fix to "git rm" as Linus
> outlined.

Note that somebody (sorry, forget who) correctly pointed out that in order 
to be "safe", the file that you "rm" has to match not only the index, but 
it should match the HEAD tree too.

If it matches both the index and the HEAD tree, a "git rm filename" is 
totally safe, since you can always get it back by just doing a

	git checkout HEAD filename

so the "git rm" really didn't lose any info, and as such, we can _happily_ 
remove the working tree copy without any concern at all.

If it doesn't match HEAD, we can't get it back as easily, so maybe that's 
the case when we want to have "git rm -f filename".

(And obviously, for all the normal reasons, if the index or HEAD doesn't 
match, the error message should be helpful and also explicitly mention the 
"-f" flag. Somehing like

	file 'x' does not match HEAD or has been staged for changes.
	Will not remove. Use '-f' to force removal.

("has been staged for changes" is just a long way of saying "index". See? 
I _can_ learn.)

		Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]