Re: [RFC] Delete current branch

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [RFC] Delete current branch

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:58:13

Ramkumar Ramachandra [off-list ref] writes:
Junio C Hamano wrote:
quoted
Did you know that the general way to spell the branch previously you
were on is "@{-1}" and "checkout -" is an ugly special case that is
possible only because "checkout" does not happen to take a "-" as a
valid argument that means something else (like the more usual "read
from standard input")?
I disagree that it is ugly: it's a very commonly used shortcut that I
like.
It does not matter if you like it or not ;-).

I do agree that "checkout -" is 100% more pleasing to the eye than
"checkout @{-1}" from visual "prettyness" point of view.

But there is a very commonly accepted long tradition for "-" to mean
"read from the standard input", so we cannot reuse it to mean "the
branch I was previously on" for every command without first making
sure the command will never want to use "-" for the other common
purpose.

That limits the context we could use "-" and we cannot consistently
use it everywhere. I find _that_ ugly from the "design cleanliness"
point of view.

Re: [RFC] Delete current branch

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:58:13

Junio C Hamano wrote:
That limits the context we could use "-" and we cannot consistently
use it everywhere. I find _that_ ugly from the "design cleanliness"
point of view.
Right, noted.

Re: [RFC] Delete current branch

From: Taylor Hedberg <hidden>
Date: 2016-06-15 22:58:13

Junio C Hamano, Fri 2013-07-19 @ 09:48:06-0700:
But there is a very commonly accepted long tradition for "-" to mean
"read from the standard input", so we cannot reuse it to mean "the
branch I was previously on" for every command without first making
sure the command will never want to use "-" for the other common
purpose.
It may be worth noting that Bash (and probably other shells as well)
allow you to type `cd -` to switch back to the previous working
directory. I always (apparently mistakenly) assumed that
`git checkout -` was deliberately designed to mirror that shortcut. I
think the symmetry gives it some credibility, in any case. This
alternative meaning for - is not totally without precedent.

What would it mean to check out the standard input, anyway? I cannot see
how that could ever make sense, unless `git checkout` gains some
additional capaabilities that are unrelated to its current purpose.
Maybe I am just being myopic, though.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help