I want to hook pre-commit
. And in pre-commit
, I want to check code style such as ./gradlew check
.
However it checks all files include staged files and non-staged files. After I format my code, ./gradlew check
passed however the modified files have not been staged. In another word, now I can commit successfully but the code in fact is not formatted.
How can I do this? Yes I can use Travis-CI
but I can not.