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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 29, 2020 at 10:50:41PM +0300, Sergey Organov wrote:
> Taylor Blau <me@xxxxxxxxxxxx> writes:
>
> [...]
>
> > 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.

> "-" standing by itself in a command means stdin, stdout, or otherwise a
> typo. Using it for any other meaning is a blasphemy. Sure, nobody will
> die because of this, but it's /extremely/ confusing!

Again, not sure that this is always the case. This *is* how 'git
checkout' works.

> BTW, what about mistyping:
>
> $ git branch -d - f my_branch
>
> for
>
> $ git branch -d -f my_branch
>
> or some such?
>
> No, it still doesn't look like a good idea to use isolated '-' as
> suggested by the patch.

Frankly, I do not find this compelling. Does that mean that '/' as a
directory separator is dangerous, too, because you can accidentally
write 'rm -rf / foo/bar/baz'?

> OTOH, for otherwise unusual @{-1}, @{-}, or @- I'd immediately realize I
> must consult the manual, so these would be fine with me.
>
> Thanks,
> -- Sergey

Thanks,
Taylor



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux