Re: [PATCH] Detached HEAD (experimental)
- From
Junio C Hamano <junkio@cox.net>
- Date
- Jan 10, 2007, 16:18 UTC
- Message-ID
- <7vsleic0t7.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <200701101010.46269.andyparkins@gmail.com>
Andy Parkins <andyparkins@gmail.com> writes:
Show 8 quoted lines
> No I'm not. Linus's suggested check is "git checkout will refuse to switch > AWAY from a detached head unless the SHA1 of the detached head exactly > matches some other branch." > > My question is what use is that? In exactly the situation you describe HEAD > doesn't match a branch. > > git checkout v1.0.0
You are taking it too literally. Read what Linus wrote again.
So if you do
git checkout v1.4.4
you'll be fine, because even though you got a detached HEAD that isn't
attached to any branch, it still exists as a tag, so checking out
something else is fine - you've not lost any state.The version in "next" does that, in a quite straightforward way:
git show-ref -d -s | grep "$old" || { barf }which should be fairly fast in a repository with packed-pruned refs.