- create a file called "pre-commit" with no extension in the project directory root
- add the code from the pre-commit file below into that new file
- create a new file called "preCommit.gradle" inside of the root
gradle
folder - add the code from the preCommit.gradle file below into that new file
- add the following line into the build.gradle file:
apply from: "$projectDir/gradle/preCommit.gradle"
Now when you run the ./gradlew build
command the git pre-commit hook will be automatically setup.