git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* "Branch exists" error while trying to rename a non-existing branch to an existing one
@ 2017-07-09 18:27 Kaartic Sivaraam
  2017-07-09 18:57 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Kaartic Sivaraam @ 2017-07-09 18:27 UTC (permalink / raw)
  To: git

Hello all,

I recently got the following error message by change as a result of the
command,

    $ git branch -m no-branch master
    fatal: A branch named 'master' already exists.

Note: no-branch is an hypothetical branch that doesn't exist.

Shouldn't I get a 'no-branch' doesn't exist before that? Wouldn't this
behaviour make the users search for the non-existing 'no-branch' in
their repo?

I tried digging the implementation a little and what I could interpret
from it is,

    * only the validity of new branch name (master, in the above case)
    is checked
    * checking for existence of the branch being renamed(no-branch) is
    not done at all. It seems to be left to the lower level commands to
    identify.

I'm puzzled by seeing this. Why isn't there any check for the existence
of the branch being renamed and warning the user about that first?

-- 
Kaartic

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-10 14:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-09 18:27 "Branch exists" error while trying to rename a non-existing branch to an existing one Kaartic Sivaraam
2017-07-09 18:57 ` Junio C Hamano
2017-07-10 14:14   ` Kaartic Sivaraam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).