Re: [PATCH] branch: add '-' to delete previous branch
- From
Sergey Organov <sorganov@gmail.com>
- Date
- May 1, 2020, 10:22 UTC
- Message-ID
- <87r1w43qfy.fsf@osv.gnss.ru>
- In-Reply-To
- <20200501094432.u3bl24qou5sgbgxk@carbon>
Konstantin Khomoutov <kostix@bswap.ru> writes:
Show 14 quoted lines
> 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.
Show 8 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