From: Junio C Hamano <gitster@pobox.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Erlend Aasland <Erlend-A@innova.no>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH] branch: delete now accepts '-' as branch name
Date: Thu, 17 Feb 2022 10:41:59 -0800 [thread overview]
Message-ID: <xmqqiltd9vyg.fsf@gitster.g> (raw)
In-Reply-To: <CAPig+cR0Ks2bnTRqs3uF4M+3q+n9X6pApBQ9HQTUq=zK5TpuXQ@mail.gmail.com> (Eric Sunshine's message of "Thu, 17 Feb 2022 12:13:10 -0500")
Eric Sunshine <sunshine@sunshineco.com> writes:
> Perhaps. Perhaps not. I may be misreading Junio's responses in this
> thread, but it didn't seem like he was necessarily opposed to the
> change.
I do not care too much about this issue to expend my political
capital on enforcing my preference ;-)
FWIW, my preference in an ideal world would be to limit "-" as a
short-hand to go back to previous (i.e. "checkout -"), which can be
justified with similarity to "cd -", but do not add any more use.
If we could, I would even deprecate "merge -", "rebase -", etc. that
can not be justified with similarity to "cd -", but I think we came
too far for that.
"-" cannot be used as a universal "the branch we last 'git checkout'
out of" notation because some commands and people expect "-" to be
something else, like "read from the standard input". The only two
reasons this pops up from time to time is because "checkout -"
exists and because "@{-N}" notation, which is accepted everywhere
uniformly and does not have problems "-" has, is not very well
known.
> A documentation update as in [1] would be a good idea, though,
> if resubmitted.
Yeah, [1] talked about both "@{-1}" and "-", but limiting it to the
former may make sense. It feels a bit odd that we single out "git
branch" and describe "@{-1}" there, when the notation is universally
available, though.
$ git grep -l '@{-' -- Documentation/ :\!Documentation/\*/\*
shows hits only in check-ref-format, checkout, switch, and worktree,
but the mention in "revisions.txt" is included in all commands in
the "log" family of commands. If we add one to "branch", we should
at least teach "@{-1}" to the documentation of merge, rebase, and
revert. The hits we see here
$ git grep -l -B1 '"@{-' \*.c
builtin/checkout.c
builtin/merge.c
builtin/rebase.c
builtin/revert.c
builtin/worktree.c
all are about replacing "-" the user typed with "@{-1}".
Continuing the "thinking aloud" a bit, I _think_ this tells us these
things:
* @{-1} has way too many letters to type to be liked by users, who
won't learn or remember what they do not appreciate (and do not
blame them---it is a bad notation).
* @{-<n>} may have been a generalized way that satisfied geeky mind
while being implemented, but the users only need the "last one"
and no such generalization.
If it is too late for a more easy-to-type-and-pleasant-to-eyes
notation, perhaps "@-", that does not have downsides of "-" or
"@{-1}", I have to wonder.
Thanks.
next prev parent reply other threads:[~2022-02-17 18: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
2022-02-16 23:06 ` Erlend Aasland
2022-02-17 17:13 ` Eric Sunshine
2022-02-17 18:41 ` Junio C Hamano [this message]
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=xmqqiltd9vyg.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=Erlend-A@innova.no \
--cc=git@vger.kernel.org \
--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.