feat: add git pre-push hook to prevent direct pushes to protected branches
This commit introduces a pre-push Git hook that prevents direct pushes to the `main` and `dev` branches. This enforces the use of pull requests for merging changes into these protected branches, promoting code review and maintaining branch stability. The changes include: - Adding a `install-git-hooks` target to the Makefile to symlink the pre-push script into the `.git/hooks/` directory. - Creating the `scripts/git-hooks/pre-push` script that checks the target branch and aborts the push if it matches a protected branch. - Updating the `CONTRIBUTING.md` file to instruct developers to install the Git hooks after setting up their development environment.
This commit is contained in:
6
Makefile
6
Makefile
@@ -74,3 +74,9 @@ create-issues-from-file:
|
||||
@echo "--> Creating GitHub issues from file..."
|
||||
@./scripts/create_issues.py
|
||||
|
||||
# --- Development Tools ---
|
||||
install-git-hooks:
|
||||
@echo "--> Installing Git hooks..."
|
||||
@ln -sf ../../scripts/git-hooks/pre-push .git/hooks/pre-push
|
||||
@echo "✅ pre-push hook installed successfully. Direct pushes to 'main' and 'dev' are now blocked."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user