Git hooks collection for Android project:
- [Pre-commit] Code autoformat with Intellij formatter in Android Studio
- [Pre-commit] Optimize import with Google Java Style Formatter
- [Pull request] Script to run Android gradle lint for changed modules only
Android Studio is installed and you must set ANDROID_STUDIO environment variable with Android Studio's path.
MacOS: /Applications/Android Studio.app
Add the contents of this repo to your root project
cd $PROJECT`
git remote add android-git-hooks https://github.com/harliedharma/android-git-hooks.git
git subtree add --prefix=git-hooks/ android-git-hooks master
Any person who clones your project must symlink the folder into .git folder
mv .git/hooks .git/hooks.old && ln -s ../git-hooks .git/hooks
You can update the hooks inside your project
git remote add android-git-hooks https://github.com/harliedharma/android-git-hooks.git
git fetch android-git-hooks master
git subtree pull --prefix=git-hooks/ android-git-hooks master