How to make ‘git diff’ ignore comments

Here is a solution that is working well for me. I’ve written up the solution and some additional missing documentation on the git (log|diff) -G<regex> option. It is basically using the same solution as in previous answers, but specifically for comments that start with a * or a #, and sometimes a space before the … Read more

ignoring changes matching a string in git diff

Try the following: $ git diff > full_diff.txt $ git diff -G “your pattern” > matching_diff.txt You can then compare the two like so: $ diff matching_diff.txt full_diff.txt If all changes match the pattern, full_diff.txt and matching_diff.txt will be identical, and the last diff command will not return anything. If there are changes that do … Read more