Created
December 11, 2016 03:42
-
-
Save aj-michael/2a6f98f7668a0369335fd35f88c1abb2 to your computer and use it in GitHub Desktop.
Configuring git to run google-java-format as a pre-commit hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ./build.gradle --- | |
plugins { | |
id "com.github.sherter.google-java-format" version "0.5" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ./.git/hooks/pre-commit --- | |
#!/bin/sh | |
git stash -q --keep-index | |
./gradlew goJF | |
git add -u | |
RESULT=$? | |
git stash pop -q | |
exit $RESULT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment