Skip to content

Commit

Permalink
chore: disallow committing to main
Browse files Browse the repository at this point in the history
Also a Github rule, but this enforces it locally
  • Loading branch information
finxol committed Jan 23, 2025
1 parent 2af4d78 commit 16741d7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

echo "Running pre-commit hook"

###################################################################
# Disallow commits to main branch #
###################################################################
pnpm commitlint --edit $1
branch=$(git symbolic-ref HEAD)
if [[ "$branch" == "refs/heads/main" ]]; then
echo "Direct commits to main branch are not allowed"
echo "Please create a feature branch and submit a PR"
exit 1
fi

###################################################################
# Format the staged files using lint-staged #
###################################################################
Expand Down

0 comments on commit 16741d7

Please sign in to comment.