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>
git diff ':!db/irrelevant.php'
It's just ':!' after your diff command. The diff command can be as complicated as you like, and you can use wildcards like *.min.js or add multiple excludes (space separate the quoted blocks) if you want.
':!'
*.min.js