Find all lines touched by author and also containing a string in Git -


is there way can scan entire repo lines touched specific author , contain string?

for example, let's 1 author has used wrong db field in code, spread out in many files. wrong db field used in many commits same author, , used correctly in other commits other authors. need change in lines in files written author, not lines written other authors.

so have have author , author b, , 2 files.

a.cpp:

use1(my_db_field); // author use5(some_other_field); // author use2(my_db_field); // author b 

b.cpp:

use3(my_db_field); // author b use4(my_db_field); // author 

so if search lines changed author , my_db_field, need both lines use1() , use4(), not use3(), use2(), or use5().

preferably, want search string ignore case , regex enabled.

is possible in git?

there isn't easy way this.

you use git log --author=foo@bar --pretty:%h give list of commits author has done, , each of run git diff against parent , see if diff has change you're looking for. you'd have brute force it.

git blame show things on file-by-file basis, , if don't know files for, may not useful. in addition hide changes author has made mistake , else has subsequently edited same line.


Comments