Git pre-commit hook: getting list of changed files

Posted by Mikko Ohtamaa on Stack Overflow See other posts from Stack Overflow or by Mikko Ohtamaa
Published on 2012-04-15T14:02:52Z Indexed on 2012/04/15 17:29 UTC
Read the original article Hit count: 249

Filed under:
|
|
|

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)?

© Stack Overflow or respective owner

Related posts about python

Related posts about git