0

How can I list branches filter by (last) author name?

For example, I want to get only main and mybranch by filtering "yukihane" from following repository.

* commit 9315faf698c4f733e96047ffe65a636330a4edc1 (origin/others, others)
| Author: other <other@example.com>
| Date:   Tue Apr 19 09:00:50 2022 +0900
|
|     others
|
| * commit c37b840649c71080eb0705e6800f359a22c1183a (HEAD -> mybranch, origin/mybranch)
|/  Author: yukihane <yukihane@example.com>
|   Date:   Tue Apr 19 08:54:02 2022 +0900
|
|       my commit
|
* commit f4e0a4721a066d1777eb7a21efdf0ede3874a4e0 (origin/main, main)
  Author: yukihane <yukihane@example.com>
  Date:   Tue Apr 19 08:53:30 2022 +0900

      init

2 Answers2

3
git log --branches --no-walk --author=yukihane
jthill
  • 55,082
  • 5
  • 77
  • 137
1

Here is what the [documentation] says[1]: [1]: https://git-scm.com/docs/git-log

To filter by author:

--author= --committer= Limit the commits output to ones with author/committer header lines that match the specified pattern (regular expression). With more than one --author=, commits whose author matches any of the given patterns are chosen (similarly for multiple --committer=).

To filter by branch:

--branches[=] Pretend as if all the refs in refs/heads are listed on the command line as . If is given, limit branches to ones matching given shell glob. If pattern lacks ?, , or [, / at the end is implied.

Other resources:

Although trying it now, I had issues getting the --branches option to work as I expected. The link above ^^^ may help.

BryanJ
  • 8,485
  • 1
  • 42
  • 61