All of lore.kernel.org
 help / color / mirror / Atom feed
From: Erlend Aasland <Erlend-A@innova.no>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH] branch: delete now accepts '-' as branch name
Date: Wed, 16 Feb 2022 23:06:34 +0000	[thread overview]
Message-ID: <400A4D37-74EA-4F3B-BA3B-99FFDAE3CB3C@innova.no> (raw)
In-Reply-To: <00720bfb-c7b7-aaf2-e846-19b08d7b9cf4@sunshineco.com>


> On 16 Feb 2022, at 20:03, Eric Sunshine <sunshine@sunshineco.com> wrote:
> 
> Patches implementing this behavior for `git branch -D` have been submitted previously but were rejected (if I recall correctly) since "delete" is a destructive operation, unlike other cases in which `-` is accepted. A relatively recent submission and ensuing discussion is at [1].
> 
> [1]: https://lore.kernel.org/git/20200501222227.GE41612@syl.local/T/

Thanks for the heads-up regarding previous discussions, Eric.

AFAIK, switch/checkout, rebase, and merge all use "-" as a shortcut to the
"last branch", so for me, it made sense with similar semantics when deleting a
branch.  I understand the concern regarding "destructive operations", but
deleting a branch is not comparable to, for example, deleting a file.  Deleting
a branch is "soft destructive";  unless *explicitly* silenced, git kindly tells
us which ref we can use to immediately recreate our branch:

$ git branch -D -  # oops, shouldn't have done that!
Deleted branch stuff (was 580cd9ab29).
$ git switch -c stuff 580cd9ab29

Until now, I've just been using the @{-1} notation, but - is very much faster
to type ;)

There are no new arguments pro this feature, so I guess the conclusion from
2020 still stands :)


E

  parent reply	other threads:[~2022-02-16 23:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16 14:08 [PATCH] branch: delete now accepts '-' as branch name Erlend Egeberg Aasland via GitGitGadget
2022-02-16 16:54 ` Junio C Hamano
2022-02-16 19:03   ` Eric Sunshine
2022-02-16 19:41     ` Junio C Hamano
2022-02-16 23:06     ` Erlend Aasland [this message]
2022-02-17 17:13       ` Eric Sunshine
2022-02-17 18:41         ` Junio C Hamano
2022-02-21 16:34           ` Ævar Arnfjörð Bjarmason
2022-02-21 17:13             ` Junio C Hamano
2022-02-21 19:20               ` Ævar Arnfjörð Bjarmason
2022-02-22 11:05                 ` Erlend Aasland

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=400A4D37-74EA-4F3B-BA3B-99FFDAE3CB3C@innova.no \
    --to=erlend-a@innova.no \
    --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.
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.