Check before you commit
Issue #7
Original post https://medium.com/@onmyway133/check-before-you-commit-5a7601cffc87
We usually have some experiment code that we don’t want they to step into our commit. I usually mark my experiment with //
Starting with 2.9, Git has improvement on its commit hook which makes it globally using hooksPath
Create pre-commit file
Create a file called pre-commit
, and place it into, for example /Users/khoa/hooks
1 |
|
Apply the hook
In your project, run git config core.hooksPath /Users/khoa/hooks
That’s it. Whenever you commit a file with that pattern, it won’t let you commit
How to use
Try
1 | // <TEST> |
and git commit -m "my commit message"
will assert with Error: Still has invalid debug markers in code: