Tkap1

Untitled

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