All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: "Branch exists" error while trying to rename a non-existing branch to an existing one
Date: Sun, 09 Jul 2017 11:57:55 -0700	[thread overview]
Message-ID: <xmqqd1998mks.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1499624859.8552.9.camel@gmail.com> (Kaartic Sivaraam's message of "Sun, 09 Jul 2017 23:57:39 +0530")

Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> 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.

  reply	other threads:[~2017-07-09 18:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2017-07-10 14:14   ` Kaartic Sivaraam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqd1998mks.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=kaarticsivaraam91196@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.