# [RFC] implement branch.sort config option

3 messages from 2018-08-13 to 2018-08-13. Participants: Samuel Maftoul, Jeff King, Junio C Hamano.
Thread: https://gitlist.dev/t/49111

## Samuel Maftoul, 2018-08-13 09:56

Subject: [RFC] implement branch.sort config option
Message-ID: <CAFj+z06S1V3Z7Z0zKPSrpZfWuzku9PTYjG+uu6ig-yCnG4FCLw@mail.gmail.com>
URL: https://gitlist.dev/e/CAFj%2Bz06S1V3Z7Z0zKPSrpZfWuzku9PTYjG%2Buu6ig-yCnG4FCLw%40mail.gmail.com

```
Currently, you can:

git tag --sort=$sorting_key

You can also do this on branches:

git branch --sort=$sorting_key

For tags, you can also configure it with a config key:

git config tag.sort $sorting_key

But there is no corresponding config for sorting branches.

Locally, I have a (pretty simple) patch that implements the
branch.sort config key.
Should I contribute that ?
Judging the number of votes and the complexity of answers to this
question https://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit,
 I would say it's a wanted and useful feature.
I'm still missing tests and docs, but if agreed the feature is useful,
I will write them.

Thanks

```

## Jeff King, 2018-08-13 17:46

Subject: Re: [RFC] implement branch.sort config option
Message-ID: <20180813174643.GA8790@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20180813174643.GA8790%40sigill.intra.peff.net
In-Reply-To: <CAFj+z06S1V3Z7Z0zKPSrpZfWuzku9PTYjG+uu6ig-yCnG4FCLw@mail.gmail.com>

```
On Mon, Aug 13, 2018 at 11:56:58AM +0200, Samuel Maftoul wrote:

> Currently, you can:
> 
> git tag --sort=$sorting_key
> 
> You can also do this on branches:
> 
> git branch --sort=$sorting_key
> 
> For tags, you can also configure it with a config key:
> 
> git config tag.sort $sorting_key
> 
> But there is no corresponding config for sorting branches.
> 
> Locally, I have a (pretty simple) patch that implements the
> branch.sort config key.
> Should I contribute that ?

Yes, that seems like a useful feature to me, and as you point out it
makes the overall interface more consistent.

-Peff

```

## Junio C Hamano, 2018-08-13 19:18

Subject: Re: [RFC] implement branch.sort config option
Message-ID: <xmqq1sb25b30.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqq1sb25b30.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <CAFj+z06S1V3Z7Z0zKPSrpZfWuzku9PTYjG+uu6ig-yCnG4FCLw@mail.gmail.com>

```
Samuel Maftoul <samuel.maftoul@gmail.com> writes:

> I'm still missing tests and docs, but if agreed the feature is useful,
> I will write them.

I personally think branch.sort would have about the same value as
the existing tag.sort, so if a patch is done well, it is likely that
users would find it valuable, but let's leave the final judgement
until we actually see the completed patch first.

Thanks.

```
