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

Re: [PATCH] branch: add '-' to delete previous branch

From
KKKonstantin Khomoutov <kostix@bswap.ru>
Date
Apr 30, 2020, 16:27 UTC
Message-ID
<20200430162753.pg6kpm6jlubotjlk@carbon>
In-Reply-To
<87imhihwbw.fsf@osv.gnss.ru>
On Wed, Apr 29, 2020 at 11:26:59PM +0300, Sergey Organov wrote:
[...]
Show 15 quoted lines
> >> > 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.
> >>
> >> Honestly, I'd never guess it'd "delete the last branch". No way.
> >
> > I'm having trouble understanding why. This is how 'git checkout -'
> > behaves, so I have no idea why 'git branch' wouldn't work the same
> > way.
> 
> Well, if I knew 'git checkout -' does this, then yes, it'd be obvious.
> The problem is that I didn't. Well, then, as I said in my original
> reaction, I'm probably too late on this.
> 
> BTW, it was not that easy to find it in the "git help checkout" even
> when I was specifically looking for it.

I would speculate that `git checkout -` may have learned about "-" simply from the `cd -` form of the standard Unix shell (also codified by POSIX [1]) which behaved that way - change the current directory to the previous one - since forever. ;-)

1. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/cd.html
Previous: Sergey OrganovNext: Junio C Hamano
Message 12 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.