Created
July 12, 2025 05:33
-
-
Save mnvr/82264144455abe1bde1ac8f0e2ae8182 to your computer and use it in GitHub Desktop.
A pre commit hook that prevents committing on main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if test "$(git rev-parse --abbrev-ref HEAD)" = "main" | |
then | |
echo "error: cannot commit to main" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment