Re: Local clone checks out wrong branch based on remote HEAD
- From
Michael J Gruber <git@drmicha.warpmail.net>
- Date
- Mar 18, 2009, 10:05 UTC
- Message-ID
- <49C0C769.8020401@drmicha.warpmail.net>
- In-Reply-To
- <20090318005413.GC25454@coredump.intra.peff.net>
Jeff King venit, vidit, dixit 18.03.2009 01:54:
Show 20 quoted lines
> On Tue, Mar 17, 2009 at 12:19:35PM -0700, Tom Preston-Werner wrote: > >> After cloning this with a standard `git clone`, the refs are: >> >> [11:48][tom@solid:~/dev/sandbox/site(release)]$ git branch -r -v >> origin/HEAD a52528a Fixed some routing problems >> origin/release a52528a Fixed some routing problems >> origin/trunk a52528a Fixed some routing problems >> >> And the checked out branch is 'release' instead of 'trunk' as I would expect: > > As others have explained, this is because the information is lacking at > the client and we are forced to make a guess. There is a heuristic in > the guess to prefer "master" if it is an option. I suppose we could make > a similar exception for "trunk", which might make sense to people > working with SVN repositories. > > OTOH, I am not sure I want to open the can of worms that is writing an > exhaustive list of heuristics that will work for everybody. Fixing the > protocol itself would probably be easier. :)
One might even argue that in case of ambiguities, checking out a detached head would be most appropriate. Really, why impose creation of certain local branches on a user at all, unless asked for? Detached heads are natural in git! But I don't really expect positive consensus on that one...
Michael