Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] Detached HEAD (experimental)

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:48

Andy Parkins [off-list ref] writes:
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help