This is usefull if you for example have one or more subtrees in your project and you do not want to see changes made in those in your diff
Say you have a folder called ‘common’. This is how to exclude it from git diff:
git diff origin/master -- . ':!/common'
Now if you have a specific file that you want to exclude the command looks like this:
git diff origin/master -- . ':!/rules/form.xml'
And if you want to exclude multiple files of folders:
git diff origin/master -- . ':!/rules/form.xml' ':!/common'
NOTE! ‘origin/master’ is just an example and not part of the solution.
Tested on Git vesion 2.23.0 on Windows 10
0 Comments.