I am trying to exclude a file (db/irrelevant.php) from a Git diff. I have tried putting a file in the db subdirectory called .gitattributes>
db/irrelevant.php
db
.gitattributes>
This method is shorter than the accepted answers.
git diff 987200fbfb 878cee40ba --stat -- ':!*.cs'
For more information about the different inclusion/exclusion possibilities read this other post