Git Hooks
commit-msg
1_ENTRIES- enforce-insert-issue-number
Make sure user did not delete the ISSUE-[#] string that was generated by prepare-commit-msg/insert-issue-number.hook.
post-checkout
2_ENTRIES- delete-pyc-files
Delete all .pyc files every time a new branch is checked out.
- new-branch-alert
Display a message when a new branch is checked out for the first time.
post-update
1_ENTRIES- update-server-info
Prepare a packed repository for use over dumb transports (e.g. http).
pre-commit
5_ENTRIES- dotenvx
Prevent committing your
.envfile(s) to code. - format-code
Run command to format code and re-add any files modified after formatting.
- search-term
Fail commit if a specific term is found in the code.
- spell-check-md-files
Check files with .md extension for spelling errors.
- verify-name-and-email
Fail commit if user.name or user.email is incorrect.
prepare-commit-msg
2_ENTRIES- include-git-diff-name-status
Include the output of "git diff --name-status -r" into the message, just before the "git status" output.
- insert-issue-number
Insert issue number to beginning of the commit message.
pre-push
1_ENTRIES- prevent-bad-push
Prevent push of commits where the log message starts with "WIP" (work in progress).
pre-rebase
1_ENTRIES- prevent-rebase
Prevent topic branches that are already merged to 'next' branch from getting rebased, because allowing it would result in rebasing already published history.
query-watchman
1_ENTRIES- fsmonitor-watchman
Output to stdout all files that have been modified since a given time.
update
1_ENTRIES- update
Block unannotated tags from entering.
Quick Start
1_ENTRIES-
Pick a hook, any hook! Try the "verify-name-and-email" one if you're not sure where to start.
-
Navigate to your project's hooks folder (.git/hooks).
-
You should see a list of files already in there. Create a new file called the exact commit type that you want to use (eg: "commit-msg", "pre-rebase", "pre-commit", etc). Do not give it an extension.
-
Save file. Done! Now the git hook will be triggered automatically.
- Open your new file and paste the code...
Open your new file and paste the code from the hook you chose out of this repo (eg: verify-name-and-email.hook).
Tools
5_ENTRIES- Husky
Manage git hooks with a nice user interface.
- Overcommit
A fully configurable and extendable git hook manager.
- Git Build Hook Maven Plugin
Install Git hooks and config during a Maven build.
- CaptainHook
Git hooks manager for PHP developers.
- pre-commit
A framework for managing and maintaining multi-language pre-commit hooks.