Re: [PATCH] checkout --track: make up a sensible branch name if '-b' was omitted
- From
- Pieter de Bie <pieter@frim.nl>
- Date
- Aug 9, 2008, 21:44 UTC
- Message-ID
- <A6E466C6-C3B5-40EB-940C-516CF4D02ADF@frim.nl>
- In-Reply-To
- <7vsktd51wg.fsf@gitster.siamese.dyndns.org>
On Aug 9, 2008, at 11:11 PM, Junio C Hamano wrote:
Show 13 quoted lines
>>> (1) You may not necessarily are used to --track, but may still >>> want this >>> done. It might not be a bad idea to associate this "local >>> dwimming" >>> to creation of a new branch. In other words, all of these: >>> >>> $ git checkout -b origin/next >> >> This cannot be dwimmed, as it literally means "start a new branch >> called >> 'origin/next' from HEAD". > > Right. Forget this part.
This is too bad. I often see people make mistakes like
git checkout -b origin/master or git checkout -b origin/master origin/master
which should be
git checkout -b origin/master master
I think both forms should at least be an error if the remote branch "origin/master" already exists, as then suddenly they aren't reachable anymore by using "origin/master".
Changing the behaviour to mean "git checkout -b origin/master master" will change the meaning, but who uses -b with an existing remote branch anyway? I think the current behaviour leads to more confusion in every case and should at least error out ("Error: creating a local repository with the same name as the remote is not allowed") or do what it's meant to do, which is create a local repository with the trailing part.
Just my .02,
- Pieter