Re: [1.8.0] Summary of the discussions

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

 



On Thu, 17 Feb 2011, Junio C Hamano wrote:

>  * "git checkout refs/heads/<name>" checks out <name> branch.
> 
>     From: Martin von Zweigbergk <martin.von.zweigbergk@xxxxxxxxx>
>     Date: Mon, 7 Feb 2011 06:01:51 -0500 (EST)
>     Message-ID: <alpine.DEB.1.10.1102062234010.3788@debian>
> 
>     -- summary --
> 
>     In addition to "git checkout <name>" that names an existing branch,
>     special case "git checkout refs/heads/<name>" to check the branch out,

At first I was going to say that I don't think special casing it
should be necessary. It seemed like as long as the name resolves to
something like refs/heads/<name>, the branch should be checked
out. Then I think I realized why you said to special case it. Since
checkout favors branches to tags, we would first have to check if
refs/heads/<arg> is valid and if it is not, check if the argument
resolves to refs/heads/<name> (maybe ignoring tags called
"heads/<name>").

>     instead of detaching HEAD at the tip of the branch.  If you want to
>     detach at a specific commit and wanted to disambiguate <name> that is
>     both a branch and another ref by checking out refs/heads/<name>, your
>     workflow will be broken by this change, but you can still say
>     refs/heads/<name>^0 to work it around.
> 
>     -- comments --
> 
>     I do not think this backward incompatible breakage would seriously
>     hurt in practice, and if people see newbies are hurt by getting a
>     detached HEAD when they check out refs/heads/<name>, this proposal
>     might be an improvement, but I have a feeling that this may be trying
>     to solve a wrong problem.
> 
>     Why are these people _tempted_ to type refs/heads/ explicitly?  It
>     could be our tutorial or documentation.  That might be the thing to
>     fix.

It wasn't until recently that I learned that "git checkout
[refs/]heads/<name>" (and rebase <upstream> [refs/]heads/name)
detaches the head, so it wasn't really to try to help newbies that I
proposed changing it. It was just that the current behavior is not
what I think most people would expect.


/Martin
--
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]