Git pre-commit hook: getting list of changed files
- by Mikko Ohtamaa
I am developing validation and linting utility to be integrated with various commit hooks, including Git one
https://github.com/miohtama/vvv
Currently validators and linters are run against the whole project codebase on every commit. However, it would be much more optimal to run them against changed files only. For this, I would need to know changed files list in my Git precommit hook (in Python)
https://github.com/miohtama/vvv/blob/master/vvv/hooks/git.py
What options I have to extract the changed files list (in Python if that matters)?