Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git command to get list of all committers to files containing specific text

Tags:

git

git-log

What git command gets the list of all committers to files containing specific text. This can optionally include a before/after parameter. The problem I am facing is, is there any specific command for this, or can I get the list of files and pipe it to some command?

like image 595
Gyanendra Singh Avatar asked Sep 14 '25 01:09

Gyanendra Singh


1 Answers

Let do that in two stages. 1st let's get the list of files:

files=`git grep -l "searh string"`

Having the list let's list all commits that touch the files, get the author's name/email for every commit, sort the list of authors printing only unique name/email.

git log --format='%an <%ae>' -- $files | sort -u

Combine two commands into one:

git log --all --format='%an <%ae>' -- `git grep -l "search string"` | sort -u
like image 85
phd Avatar answered Sep 15 '25 15:09

phd