简体   繁体   中英

Git > diffs filtered, show only certain changed classes/files

I have 2 versions of a software (ie tag 4.1 and tag 4.2).

Now I want to filter out in which java classes of version 4.1 there were fixed bugs.

If I enter git diff r4.1 r4.2 --name-only > patch.csv I get a list of all changed classes from version 4.1 to 4.2. But this list also consists changes that were not based on a bug.

Is there a possibility that I can filter the result in order to only display classes which were changed because of a commit which contained the word "bug". In example "git log --grep=bug". Can I combine this with the "diff" command?

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

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

git log r4.1..r4.2 --name-only --grep=bug --pretty=oneline should give you a list of commit message headers and the files changed in them without the commit message itself. You could then redirect the output to get an easy to read list of classes:

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

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