Setting Up Custom git-hooks Globally
Overview
This applies to all git-managed development environments locally.
What I Did
This time, I configured pre-commit.
- PHP syntax check
- Prohibit commits on the master branch
→ master should only be pushed after merging.
- Since I use phpmd for PHP syntax checking, make sure to install phpmd.
1 | brew install phpmd |
Steps
The steps are documented in the README of git-hook below.
https://github.com/kenzo0107/git-hooks
Notes
I’ll also write up other things later once I’ve put them together, such as using pre-push to allow pushing only to the remote branch with the same name as the current branch.
That’s all.
