threads / discuss / 50362

Feature suggestion: Filter branches by user

Subject: Feature suggestion: Filter branches by user

## tl;dr

3 messages between Jan 30, 2019 and Jan 30, 2019.

replies: 2people: 2as markdown or json

Victor Porton· Jan 30, 2019, 15:13 UTC · lore
I want Git to display all branches created by me.

So we need the new feature of Git, to display all branches created by a given user ("me" by default).

I think, the similar feature for tags may also be useful.
Jacob Keller· Jan 30, 2019, 21:49 UTC · re: Victor Porton · lore

Re: Feature suggestion: Filter branches by user

On Wed, Jan 30, 2019 at 7:22 AM Victor Porton <porton@narod.ru> wrote:
Show 8 quoted lines
>
> I want Git to display all branches created by me.
>
> So we need the new feature of Git, to display all branches created by a
> given user ("me" by default).
>
> I think, the similar feature for tags may also be useful.
>

Branches don't contain authorship, as far as I know. Annotated tags do, but lightweight tags do not.

For annotated tags you should be able to build an alias which lists all the tag objects and includes the author, i.e.

git for-each-ref --format='%(refname)%09%(tagger)' refs/tags
This will list the refname along with its tagger.

I'm sure patches to add a "--tagger" option to git tag in list mode would also be welcome.

Thanks, Jake

Jacob Keller· Jan 30, 2019, 21:58 UTC · lore

Re: Feature suggestion: Filter branches by user

On Wed, Jan 30, 2019 at 1:51 PM Victor Porton <porton@narod.ru> wrote:
Show 14 quoted lines
>
> On 30/01/2019 23:49, Jacob Keller wrote:
> > On Wed, Jan 30, 2019 at 7:22 AM Victor Porton <porton@narod.ru> wrote:
> >> I want Git to display all branches created by me.
> >>
> >> So we need the new feature of Git, to display all branches created by a
> >> given user ("me" by default).
> >>
> >> I think, the similar feature for tags may also be useful.
> >>
> > Branches don't contain authorship, as far as I know. Annotated tags
> > do, but lightweight tags do not.
> So it should be changed. Branches should contain authorship (to
> implement my feature suggestion).
If you wanted to implement such a feature, yes that would have to be part if it.

I do not believe that it would be easy, and it would likely require a lot of effort to do so, because branches don't point to specific objects (unlike annotated tags), and thus the information about "who created a branch" would not align well with an object.

You *can* use the most recent commit in a branch as a proxy of "who last edited this branch", possibly by using the committer.

However, because branches change over time, (as new commits are added), you can't simply store the information of who created the branch as an object (which is what annotated tags do).

I'm not sure this is feasible.

A simpler solution for your end, is to have an standard prefix you use for your own branches (i.e. I use jk-, because that's my initials). Then you can use prefix matching to find the branches that are your own.

Thanks, Jake

P.S. It helps if you leave the list in the reply line so that the discussion remains public, as this is an open mailing list.

← back to recent threads