Skip to content

Instantly share code, notes, and snippets.

@aj-michael
Created December 11, 2016 03:42
Show Gist options
  • Save aj-michael/2a6f98f7668a0369335fd35f88c1abb2 to your computer and use it in GitHub Desktop.
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
--- ./build.gradle ---
plugins {
id "com.github.sherter.google-java-format" version "0.5"
}
--- ./.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