Web lists-archives.com

"Branch exists" error while trying to rename a non-existing branch to an existing one

Hello all,

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

    $ 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

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?