Web lists-archives.com

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

Kaartic Sivaraam <kaarticsivaraam91196@xxxxxxxxx> writes:

> 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?

This is borderline "meh" at least to me.  An argument against a
hypothetical version of Git that "fixes" your issue would be that no
matter what the source of renaming is, as long as 'master' exists,
"branch -m" shouldn't overwrite it, and it is a good thing to remind
the user that 'master' exists and the user meant to rename it to
something else.

Of course you can make the error message three-way, but I do not
think it is worth it.