Can git recognize all authors who have ever changed a line of code?

I would like to know all the authors who changed the line of code. Git -log can do this at the file level. I read the man page and it looks like git log cannot do this at line level. Is there a way to use the git command for this, or do I need to write a script for myself?

For my purpose, I would like to do this with all lines of code. I do this to prepare data for authorship training for my research.

+5
source share
1 answer

You want to combine flags -Sand --prettyon git log.

On the git logman page, -Spickaxe search:

   -S<string>
       Look for differences that introduce or remove an instance of <string>. Note that this is different than the string simply appearing in diff output;
       see the pickaxe entry in gitdiffcore(7) for more details.

. SO, git log -g -Ssearch_for_this "search_for_this".

--pretty, . , "foo" , , , , :

$ git log -Sfoo --pretty=format:'%h %an -- %s -- %ad'
bc34134 Sally Developer -- Fixed all bugs and made all clients happy forever -- Tue Jan 31 17:41:17 2025 -0500
+3

All Articles