git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Marcus Kida <marcus.kida@gmail.com>
To: git@vger.kernel.org
Subject: Bug: git branch -D can be used to delete branch which is currently checked out
Date: Thu, 10 Mar 2016 19:20:21 +1100	[thread overview]
Message-ID: <CE5AE06C-0909-414E-B901-7CCF3A259465@gmail.com> (raw)

Testes on: 

Mac OS X 10.11.3 (El Capitan) using Git 2.6.4

Issue:

git branch -D can be used to delete branch which is currently checked out

Steps to reproduce:

inside a git repository:

$ git checkout -b feature/myAwesomeFeature

-> you end up in feature/myAwesomeFeature branch

$ git checkout FEATURE/myAwesomeFeature

-> you end up in FEATURE/myAwesomeFeature branch

$ git branch -D feature/myAwesomeFeature branch

-> BOOM you just deleted the branch you were at. Congrats you repo is dirty again.

Actual behaviour:

It seems like checking out / deleting branches is case insensitive thus you can delete a branch you are on by just using a different capitalisation when specifying the branch to delete.

Expected behaviour:

error: Cannot delete the branch 'FEATURE/myAwesomeFeature' which you are currently on.

Thank you, please don't hesitate to contact me in case you need more info or if this has already been fixed in the meantime.

Cheers,
Marcus

             reply	other threads:[~2016-03-10  8:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-10  8:20 Marcus Kida [this message]
2016-03-10 17:40 ` Bug: git branch -D can be used to delete branch which is currently checked out Junio C Hamano
2016-03-10 18:23   ` Junio C Hamano
2016-03-10 18:38     ` Marcus Kida

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=CE5AE06C-0909-414E-B901-7CCF3A259465@gmail.com \
    --to=marcus.kida@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).