How to setup spotless for a git pre commit hook that only check changed files
I'm using spotless with an android kotlin project now. And I have spotless set up like this
apply plugin: 'com.diffplug.gradle.spotless' spotless { kotlin { target "**/*.kt" ktlint(versions.ktlint) } }
What I want to do is set up a git pre commit hook that apply gradlew spotlessCheck before the commit but only on the commited files. It's something like this eslint-pre-commit-check
I have search around the repo but can't figure out how to achieve this. Is there any way to do this? Thanks.