简体   繁体   中英

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

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?

probably something along the lines of

git log --all -S "the string you search for" --pretty='%cn%n'

Details :

-S filters commits using the string given in following parameter

%cn prints the committer name

%n is just a new line

尝试使用此命令为包含特定文本的文件提供所有提交者名称和电子邮件:

    git log -S "search string" --stat --pretty=format:"%cn -%ce (%cd)"

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM