I'm using a git pre-commit hook to check commits. The pre-commit script basically does one thing:
exec git diff-index --check --cached HEAD --
It does some other things too, but they are irrelevant for this discussion.
The problem is, I have all sorts of files in the repository, and not all of them have to comply with the checks that enforced by "git diff-index --check
".
So my question is: how can I exclude/ignore these files? That is, I do track them in git, but I want to ignore them in pre-commit check only.
For instance, a certain patch contains *.c, *.h, *ini, and *.xyz files.
I want the "git diff-index --check
" to apply to .c and .h files only.