Skip to content

Instantly share code, notes, and snippets.

@svachalek
Created April 22, 2013 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svachalek/5437407 to your computer and use it in GitHub Desktop.
Save svachalek/5437407 to your computer and use it in GitHub Desktop.
pre-commit hook to prevent commit on detached head
#!/bin/sh
if ! git symbolic-ref HEAD &> /dev/null; then
echo "You are in a detached head state! Commit has been blocked. (Use --no-verify to bypass this check.)"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment