Skip to contentSkip to conversation

Detaching head at checked out point does not work.

BUG? Jan Hudec 2 participants 5 messages Jun 15, 2016

lore
Share & tools
lore

Jan Hudec

author
#0 lore raw

Hello,

I can correctly detach head by saying:

git checkout master^0

(or git checkout master^{} or git checkout refs/heads/master), but NONE of these work, if I currently have master checked out. Shouldn't it detach anyway?

Regards,

Jan

Signature · 1 line
						 Jan 'Bulb' Hudec <[email protected]>
#1 lore raw
Quoted 9 lines · Jan Hudec

Hello,

I can correctly detach head by saying:

git checkout master^0

(or git checkout master^{} or git checkout refs/heads/master), but NONE of these work, if I currently have master checked out. Shouldn't it detach anyway?

Yes, and it does as far as I know.

Do you have 3e0318a3?

commit 3e0318a3613ae8e89dcb1fc39d909145e64287b9

Author: Junio C Hamano <[email protected]>
Date:   Thu Mar 29 01:02:50 2007 -0700

checkout: allow detaching to HEAD even when switching to the tip of a branch

You cannot currently checkout the tip of an existing branch without moving to the branch.

This allows you to detach your HEAD and place it at such a commit, with:

$ git checkout master^0

author
#2 lore raw
Quoted 8 lines · Junio C Hamano
Quoted 6 lines · Jan Hudec

Hello,

I can correctly detach head by saying:

git checkout master^0

Quoted 7 lines
Quoted 3 lines

(or git checkout master^{} or git checkout refs/heads/master), but NONE of these work, if I currently have master checked out. Shouldn't it detach anyway?

Yes, and it does as far as I know.

Do you have 3e0318a3?

It does not seem to be in 1.5.1.4, so no, I don't.

I apologise for not looking whether head has a fix.

Signature · 1 line
						 Jan 'Bulb' Hudec <[email protected]>
#3 lore raw
Quoted 11 lines · Jan Hudec
Quoted 10 lines · Junio C Hamano
Quoted 7 lines · Jan Hudec

I can correctly detach head by saying:

git checkout master^0

(or git checkout master^{} or git checkout refs/heads/master), but NONE of these work, if I currently have master checked out. Shouldn't it detach anyway?

Quoted 5 lines
Quoted 3 lines

Yes, and it does as far as I know.

Do you have 3e0318a3?

It does not seem to be in 1.5.1.4, so no, I don't.

As that commit is directly on top of v1.5.1, I think it may not hurt to cherry-pick that single commit to 'maint' for 1.5.1.5, although some may argue that it is not strictly a bugfix but a new feature.

author
#4 lore raw
Quoted 15 lines · Junio C Hamano
Quoted 13 lines · Jan Hudec
Quoted 12 lines · Junio C Hamano
Quoted 7 lines · Jan Hudec

I can correctly detach head by saying:

git checkout master^0

(or git checkout master^{} or git checkout refs/heads/master), but NONE of these work, if I currently have master checked out. Shouldn't it detach anyway?

Yes, and it does as far as I know.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Do you have 3e0318a3?

It does not seem to be in 1.5.1.4, so no, I don't.

As that commit is directly on top of v1.5.1, I think it may not hurt to cherry-pick that single commit to 'maint' for 1.5.1.5, although some may argue that it is not strictly a bugfix but a new feature.

I would not call it a new feature, since it worked if I had something else than master checked out. It is not a regression though and given that 1.5.2 is getting closer I'm not sure it's worth bothering.

Signature · 1 line
						 Jan 'Bulb' Hudec <[email protected]>