Re: "Branch exists" error while trying to rename a non-existing branch to an existing one
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 9, 2017, 18:57 UTC
- Message-ID
- <xmqqd1998mks.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1499624859.8552.9.camel@gmail.com>
Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> writes:
Show 9 quoted lines
> 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.