On Wed, Apr 29, 2020 at 11:26:59PM +0300, Sergey Organov wrote: [...] > >> > 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