Git> diffs filter, show only some changed classes / files

I have 2 versions of software (i.e. tag 4.1 and tag 4.2).

Now I want to filter in which Java 4.1 classes the bugs were fixed.

If I enter git diff r4.1 r4.2 --name-only > patch.csv

, I get a list of all changed classes from 4.1 to 4.2. But this list also contains changes that were not based on a bug.

Is there any chance that I can filter the result to only show classes that have changed due to a commit containing the word "error". In the example "git log --grep = bug". Can I combine this with the "diff" command?

If this is not possible, I would also be fine when I just look at version 4.2 and get a list of the changed classes that result from the bug fix.

something like this git r4.2 log --grep=bug --name-only

?

+3


source to share


1 answer


git log r4.1..r4.2 --name-only --grep=bug --pretty=oneline

should give you a list of the commit message headers and the files modified in them, without the commit message itself. Then you can redirect the output to get an easily readable list of classes:



$ git log r4.1..r4.2 --name-only --grep=bug --pretty=oneline | grep "\.java$" | sort | uniq

      

+3


source







All Articles