Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent commiting to default main branch in local repo #25

Open
somombo opened this issue Jun 9, 2022 · 2 comments
Open

prevent commiting to default main branch in local repo #25

somombo opened this issue Jun 9, 2022 · 2 comments

Comments

@somombo
Copy link
Contributor

somombo commented Jun 9, 2022

add the following pre-commit hook

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

if [ "$branch" = "main" ]; then
  echo "Dev Branch commit is blocked"
  exit 1
fi

if [ "$branch" = "master" ]; then
  echo "Master Branch commit is blocked"
  exit 1
fi
@somombo
Copy link
Contributor Author

somombo commented Jun 9, 2022

@somombo
Copy link
Contributor Author

somombo commented Jun 9, 2022

Lucian mentioned this should probably be controlled at the repo settings level

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant