Re: [PATCH] checkout -d: explicitly detach HEAD even when switching to the tip of a branch

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

 




On Tue, 3 Apr 2007, Junio C Hamano wrote:
> 
> Could anybody remind me why we have the "new != old" check here?

Afaik, it's just so that you can do

	git checkout -f

without having it complain. And I think it just comes from the earlier:

	[ -z "$new" ] && new=$old && new_name="$old_name"

that we did - ie without that it would incorrectly just overwrite the 
current working tree with the new commit, but not actually do the "git 
reset" part.

So without that check, the way things used to work (*before* detached 
heads), if you were to have done

	git checkout <some-random-head>

it would have screwed up the current branch horribly.

With detached heads, I don't think it's needed.

		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]