Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh bash
- # The text that refuses the commit
- # Change it to match your needs; keep it enclosed in single quotes
- MARKER='// nocheckin'
- # Verify the staged files for the presence of the marker text
- if git diff --cached --name-only | xargs grep -q "$MARKER"; then
- echo 'Cannot commit because the "no-commit" marker has been found in one of the staged files.' 1>&2
- # Refuse to commit
- exit 1
- fi
Add Comment
Please, Sign In to add comment