0

I'm trying to find all commits made by Matt, but in my repository there are a couple of users with similar names (e.g., Matthew), and git log --author="Matt" covers these users that are not Matt.

Is there a way to say to git do not be that smart and filter only the string that I'm looking for?

  • possible duplicate of http://stackoverflow.com/questions/4259996/how-can-i-view-a-git-log-of-just-one-users-commits – Priyanshu Oct 21 '15 at 14:15
  • Not actually. The solutions proposed have the same problems that I mentioned here. – Gustavo Pinto Oct 21 '15 at 14:17
  • Then I don't think there is any other better way to do that using git commands. Probably you can use some shell command for that. – Priyanshu Oct 21 '15 at 14:24
  • How about piping the output from git into `grep`? – wspurgin Oct 21 '15 at 14:28
  • Other way around is in GUI, click the author's username from anywhere in the commit history, and the commits you can see filtered commits by that author's username – Priyanshu Oct 21 '15 at 14:28
  • GUI will not help much, because I need to do this on thousand of commits. The --author flag supports regular expressions. But `--author="^Matt$"` does not work, although it works on grep. – Gustavo Pinto Oct 21 '15 at 14:35

1 Answers1

3

If you read this answer carefully, and the git log docs, you could do that either by:

  • using -F flag (which treats the string as a string to look for, not a pattern), or
  • using -E flag along with a regexp

Note that to do that, you have to think of the author as the full author name, which I believe is the same, that git log without filtering prints.

Using -F flag (I checked it for me and it worked):

$ git log -F --author='Matt <matt@matts.email.com>'

Using regexp:

$ git log -E --author='^Matt\s<(.+)>$'

I tested both on my git console, and both worked.

Community
  • 1
  • 1
Kleskowy
  • 2,648
  • 1
  • 16
  • 19