Thread (4 messages) flat view 4 messages, 3 authors, 2016-06-15

Re: [PATCH] checkout --track: make up a sensible branch name if '-b' was omitted

From: Pieter de Bie <hidden>
Date: 2016-06-15 22:45:07

On Aug 9, 2008, at 11:11 PM, Junio C Hamano wrote:
quoted
quoted
(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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help