git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.)

Previous: Taylor BlauNext: Sergey Organov
Message 4 of 25 in “branch: add '-' to delete previous branch”
  1. branch: add '-' to delete previous branchIvan Tham, Apr 29, 2020
  2. Sergey OrganovApr 29, 2020
  3. Taylor BlauApr 29, 2020
  4. Eric SunshineApr 29, 2020
  5. Sergey OrganovApr 29, 2020
  6. Taylor BlauApr 29, 2020
  7. Junio C HamanoApr 29, 2020
  8. Taylor BlauApr 29, 2020
  9. Junio C HamanoApr 29, 2020
  10. Junio C HamanoApr 29, 2020
  11. Sergey OrganovApr 29, 2020
  12. Konstantin KhomoutovApr 30, 2020
  13. Junio C HamanoApr 30, 2020
  14. Sergey OrganovMay 1, 2020
  15. Konstantin KhomoutovMay 1, 2020
  16. Sergey OrganovMay 1, 2020
  17. Taylor BlauMay 1, 2020
  18. Ivan ThamApr 30, 2020
  19. Junio C HamanoApr 29, 2020
  20. Randall S. BeckerApr 29, 2020
  21. Sergey OrganovApr 29, 2020
  22. Taylor BlauApr 29, 2020
  23. Ivan ThamApr 30, 2020
  24. Taylor BlauApr 30, 2020
  25. Junio C HamanoApr 30, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.