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

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

From
Taylor Blau <me@ttaylorr.com>
Date
May 1, 2020, 22:22 UTC
Message-ID
<20200501222227.GE41612@syl.local>
In-Reply-To
<87r1w43qfy.fsf@osv.gnss.ru>
On Fri, May 01, 2020 at 01:22:25PM +0300, Sergey Organov wrote:
Show 22 quoted lines
> Konstantin Khomoutov <kostix@bswap.ru> writes:
>
> > On Fri, May 01, 2020 at 12:18:31PM +0300, Sergey Organov wrote:
> >
> > [...]
> >> >> I would speculate that `git checkout -` may have learned about "-"
> >> >> simply from the `cd -` ...
> >> >
> >> > You do not have to speculate.  You only need to read what has been
> >> > already said in the thread ;-).
> >>
> >> Should I expect "git checkout ~" to get me to my "home" branch then? ;-)
> >
> > Heh, no you shouldn't: the '~' is expanded by the shell itself according
> > to its parameter expansion rules, so `cd` never sees the bare tilde
> > in this case ;-)
>
> Yeah, but then git could compare its argument to $HOME and "do the right
> thing" ;-) Just kidding, obviously.
>
> That said, bare "cd" also changes to home directory, so bare "git
> checkout" could become as useful.

My qualms about the general usefulness of a bare 'git checkout' going to some bookmarked branch aside, this won't work, since a bare 'git checkout' already sets HEAD to the currently checked-out branch.

That said, I am not at all sold on this being a good idea.
Show 12 quoted lines
> >
> >> Actually, that could be a good idea. I mean, to have "home" branch
> >> notion and a short-cut for it.
> >
> > I have no say for the idea per se but you would have hard time using
> > bare tilda character for that precisely because of it being special to
> > Unix shells - you'd need to escape it all the time (though something
> > like unquoted @{~} would work just OK).
>
> Yes, plain '~' won't do.
>
> -- Sergey

Thanks, Taylor

Previous: Sergey OrganovNext: Ivan Tham
Message 17 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.