Re: git checkout -b origin/mybranch origin/mybranch
- From
John Tapsell <johnflux@gmail.com>
- Date
- Mar 12, 2009, 13:18 UTC
- Message-ID
- <43d8ce650903120618h79686207vaa478c54f34e26f8@mail.gmail.com>
- In-Reply-To
- <alpine.DEB.1.00.0903121357320.6335@intel-tinevez-2-302>
2009/3/12 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
Show 40 quoted lines
> Hi, > > On Thu, 12 Mar 2009, John Tapsell wrote: > >> 2009/3/12 Johannes Schindelin <Johannes.Schindelin@gmx.de>: >> >> > On Thu, 12 Mar 2009, John Tapsell wrote: >> > >> >> One of my collegues did: >> >> >> >> git checkout origin/somebranch >> >> >> >> git complained that they need to specify the name with -b. So they did: >> >> >> >> git checkout -b origin/somebranch origin/somebranch >> > >> > Yeah, a pilot error. It should have been >> > >> > $ git checkout -t origin/somebranch >> >> Maybe the error message for "git checkout origin/somebranch" should >> suggest: git checkout -t origin/somebranch? >> >> > I have to wonder, though, why "git checkout origin/somebranch" did not >> > detach your HEAD. >> >> It did. But that doesn't affect doing "git checkout -b >> origin/somebranch origin/somebranch" afterwards. > > So did the warning read something like this? > > -- snip -- > moving to "d36a18dc9cdf1dfce8632e42491b826387aa3230" which isn't a local > branch > If you want to create a new branch from this checkout, you may do so > (now or later) by using -b with the checkout command again. Example: > git checkout -b <new_branch_name> > -- snap -- > > ?
I'm really not sure what point you're trying to prove. Yes, we all know that the user made a mistake in thinking that the new_branch_name should be "origin/mybranch".
What I'm suggesting is that git tries to not let the user shoot himself in the foot so easily.
I'm saying that:
git checkout -b origin/mybranch origin/mybranch
Is probably a mistake by the user. We should warn the user and point them in the right direction.
John