Skip to content

Commit

Permalink
Disallow committing and pushing to main directly (#3116)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezhan-codaio authored Nov 23, 2024
1 parent be35cac commit 350e1d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .githooks/pre-commit/disable-commit-to-main
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

branch="$(git rev-parse --abbrev-ref HEAD)"

if [ "$branch" = "main" ]; then
echo "Committing to main directly is not allowed."
exit 1
fi
8 changes: 8 additions & 0 deletions .githooks/pre-push/disable-push-to-main
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

branch="$(git rev-parse --abbrev-ref HEAD)"

if [ "$branch" = "main" ]; then
echo "Pushing to main directly is not allowed."
exit 1
fi

0 comments on commit 350e1d4

Please sign in to comment.