Skip to content

Instantly share code, notes, and snippets.

@Tsugami
Created June 14, 2021 18:41
Show Gist options
  • Save Tsugami/e9d26a8c4e50462898ee2156b9a56742 to your computer and use it in GitHub Desktop.
Save Tsugami/e9d26a8c4e50462898ee2156b9a56742 to your computer and use it in GitHub Desktop.
branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "main" ] || [ "$branch" = "dev" ]; then
echo "You can't commit directly to the \"$branch\" branch, please checkout to a new branch before committing"
exit 1
f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment