A small collection of custom git hooks and their automatic activation in the local workspace.
This project is for now...
- A minimal gradle project with git hook activation defined in build.gradle.kts
- A minimal npm project with git hook activation defined in scripts/githooks.js (triggered by package.json)
- A git hook to check the format of commit messages defined in .githooks/commit-msg
- A git hook to check the number of changed files in commits defined in .githooks/pre-commit
- A git hook to check the project state before pushes defined in .githooks/pre-push
- Gradle: Load gradle in your IDE or run any task (e.g.
gradlew tasks
)... - NPM: Install dependencies (
npm install
)... - Others: Call
git config --local core.hooksPath .githooks
(mention in your readme as part of the project setup)...
...so .githooks is set as your git hooks directory (entry can be found in local git config).
Commit any change with a message (-m
) to see how hook commit-msg is working.
Commit many changes with added or modified files to see how hook pre-commit is working.
Push commits while your build system (gradle/npm) has a check
task/script to see how hook pre-push is working.
Edit these hook files as needed for your project (e.g. other ticket prefix).