Re: [PATCH] branch: add '-' to delete previous branch
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Apr 29, 2020, 19:06 UTC
- Message-ID
- <CAPig+cT7sBn58THC_PGw-xoSH3BmZiiO31yJwOL-TV3gAhATHQ@mail.gmail.com>
- In-Reply-To
- <20200429190013.GG83442@syl.local>
On Wed, Apr 29, 2020 at 3:00 PM Taylor Blau <me@ttaylorr.com> wrote:
Show 17 quoted lines
> On Wed, Apr 29, 2020 at 04:37:27PM +0300, Sergey Organov wrote:
> > Ivan Tham <pickfire@riseup.net> writes:
> > > Add support to delete previous branch from git checkout/switch to have
> > > feature parity with git switch -.
> >
> > Maybe I'm late on this, but to me, who leaves in the Linux world,
> > "a_command -" strongly suggests a_command will read further input
> > from stdin.
> >
> > Is this short-cut /that/ important to create yet another confusion?
>
> I think that it may be causing more confusion now than it would be after
> Ivan's patch. 'git checkout', for example, also treats '-' as a synonym
> for '@{-1}'.
>
> In my opinion, it is fairly clear that 'git branch -D -' means "delete
> the last branch", and not "delete a list of branches from stdin.I can't find the discussion right now, but I have a recollection that "git branch -D -" was explicitly rejected when "-" was being added as an alias for @{-1} to other modes and other commands. The reason for the rejection was that branch deletion is a destructive operation (the ref-log, in particular, is gone after deletion), and "-" alone provides no clues and no context that you're deleting the branch you intend to delete. (The lack of clues and context isn't a big deal for non-destructive commands, such as git-switch.)