Pre-push
The pre-push rule follows the following steps:
Create a .git/hooks/pre-push file.
Write the shell script below.
#!/bin/sh FILES=$(git diff --cached --name-only --diff-filter=AM | grep -E '\.kt$|\.kts$|\.xml$') if [ -z "$FILES" ]; then exit 0 fi for FILE in $FILES; do ./gradlew --init-script gradle/init.gradle.kts spotlessApply -Pspotless.target="$FILE" donePerform a push operation to verify that the above steps are applied.
Last modified: 22 July 2023