A pre-commit hook that prevents from commiting if the text nocheckin is present in any of the staged files.
Special thanks to ElpieKay who did all the hard work. Also thanks to jthill for a slight improvement.
The original question and source can be found here: https://stackoverflow.com/a/59133674/1022707
The reason I make a repository out of this is so people can watch it and will be notified if anyone will post an issue. Since so far this has not been heavily tested.
V5:
- @ prefix no longer required, and search is case insensitive.
V4:
- added "--diff-filter=d" to fix problem with deleted files.
V3:
- All filenames containing @NOCHECKIN are listed now instead of only the first one.
V2:
- Not a single file is commited now when @NOCHECKIN is present (before it would commit the files that did not have an @NOCHECKIN).
V1:
- initial
This pre-commit file should be placed inside .git/hooks.
Make sure the pre-commit file has the permisions to be executed!
E.g. chmod +x pre-commit on OSX.
For those interested, it also works with Fork.
