From: Junio C Hamano <gitster@pobox.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Erlend Egeberg Aasland via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org,
Erlend Egeberg Aasland <erlend.aasland@innova.no>
Subject: Re: [PATCH] branch: delete now accepts '-' as branch name
Date: Wed, 16 Feb 2022 11:41:52 -0800 [thread overview]
Message-ID: <xmqqv8xed2f3.fsf@gitster.g> (raw)
In-Reply-To: <00720bfb-c7b7-aaf2-e846-19b08d7b9cf4@sunshineco.com> (Eric Sunshine's message of "Wed, 16 Feb 2022 14:03:38 -0500")
Eric Sunshine <sunshine@sunshineco.com> writes:
> On 2/16/22 11:54 AM, Junio C Hamano wrote:
>> From: "Erlend E. Aasland" <erlend.aasland@innova.no>
>>> This makes it easy to get rid of short-lived branches:
>>>
>>> $ git switch -c experiment
>>> $ git switch -
>>> $ git branch -D -
>> Or you can use @{-1} directly. Or short-lived experiment can
>> directly be done on HEAD without any branch ;-)
>> Thanks for trying to make Git better.
>
> 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/
I think the thread around <vpqh944eof7.fsf@anie.imag.fr> is what you
have in mind as the origin of
* "-" usually stands for "read from standard input" and using it to
mean "the previous branch" is a source of confusion, and cannot
be defended with the excuse of "'cd -' is used to go back to
where we were" when the command is not going back to that branch
(i.e. not "checkout -" or "switch -").
* it is doubly dubious to make it easy to type "-" to cause
something destructive.
* on the other hand, since "checkout -" already makes "-" as a
synonym to "@{-1}", not supporting it elsewhere may appear
inconsistent.
I personally am sympathetic to the first point, but not that
sympathetic to the second one. We made it worse since then by
accepting "merge -", which is not about going back, though.
next prev parent reply other threads:[~2022-02-16 19:42 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 [this message]
2022-02-16 23:06 ` Erlend Aasland
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=xmqqv8xed2f3.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=erlend.aasland@innova.no \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=sunshine@sunshineco.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.