Thread (1 message) 1 message, 1 author, 2016-06-15

Re: 'git branch' when origin branch with same name exists

From: Thomas Rast <hidden>
Date: 2016-06-15 22:54:08

Ryan Lortie [off-list ref] writes:
In this case, the user wanted to checkout a branch of a module.  They did:

  git clone git://git.gnome.org/gtk+
  cd gtk+
  git branch gtk-3-4

Obviously this is a user error, but it's a pretty innocent one, and
puts the user in a bad state.  When they figure they should have typed
"git checkout gtk-3-4" it is already too late -- they will be taken
onto their locally-created copy of the master branch.

So feature request: 'git branch' should not allow creating a local
branch that has the same name as a branch that already exists on
origin' (or any remote?) without some sort of --force flag.
How does this fit with the fact that git has forever(?) created a
'master' branch when cloning, and usually points it at origin/master
too?

I honestly haven't decided whether I should like or hate your proposal,
but ISTM that outlawing an operation that git does on every clone is a
bit moot.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help