You can add a pre-commit that exits with a non-zero value if you find unnecessary files (you could examine the output of git status --porcelain -u to determine their presence - find lines starting with "?"). You can then override the commit check with git commit --no-verify if you are not interested in unused files.
Edit: thanks @Jefromi; I don't have my git environment for testing. He also notes that this command should identify the presence of unprocessed files: git status -u | grep '^# Untracked files:$' git status -u | grep '^# Untracked files:$' .
source share