Thread (2 messages) 2 messages, 2 authors, 2020-04-30

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

From: Konstantin Khomoutov <hidden>
Date: 2020-04-30 16:58:14

On Wed, Apr 29, 2020 at 11:26:59PM +0300, Sergey Organov wrote:

[...]
quoted
quoted
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help