Re: [PATCH v2 1/1] branch: introduce --show-current display option
- From
Jeff King <peff@peff.net>
- Date
- Oct 11, 2018, 17:51 UTC
- Message-ID
- <20181011175136.GA8825@sigill.intra.peff.net>
- In-Reply-To
- <1409ebd2-d72c-fbd6-bf5c-777342723ca2@umanovskis.se>
On Thu, Oct 11, 2018 at 06:36:02PM +0200, Daniels Umanovskis wrote:
Show 14 quoted lines
> On 10/11/18 5:43 PM, Rafael Ascensão wrote: > > I agree it feels a bit out of place, and still think that > > > > $ git branch --list HEAD > > > > would be a good candidate to be taught how to print the current branch. > > I am not a fan because it would be yet another inconsistency in the Git > command interface. An argument given after git branch --list means a > pattern for the branches to list. Making HEAD print the current branch > would be an exception to what an argument in that place means. Yes, HEAD > itself is a very special string in git, but I'm not a fan of syntax > where a specific argument value does something very different from any > other value in that place.
Yeah, I agree. If we were to go this route, it should probably be:
git branch --list-head
Which sounds a lot like what you are proposing, but I think the name implies more strongly "show --list, but only for the HEAD". I.e., for the detached case, show the "HEAD detached at..." text.
-Peff