-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
6404: prevent contributors from opening a PR on a main branch #6419
6404: prevent contributors from opening a PR on a main branch #6419
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Introduced a pre-push Git hook to prevent contributors from pushing directly from the main branch, enforcing better branching practices.
- Added
hooks/pre-push
to check the current branch and exit with an error if it is 'main'. - Updated
package.json
to include apostinstall
script that runsscripts/setup-hooks.sh
. - Added
scripts/setup-hooks.sh
to automate the installation of the pre-push Git hook.
3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
Hey Rakesh, not a fan of git hooks as I feel they can be a bit annoying / we prefer to educate rather than constrain. But happy to merge the documentation change in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
The pre-push Git hook and related setup scripts were removed, shifting the approach to prevent contributors from opening PRs from the main branch.
- Removed
hooks/pre-push
, eliminating the automated branch check. - Deleted
scripts/setup-hooks.sh
, which previously installed the pre-push hook. - Modified
package.json
to remove thepostinstall
script that executedsetup-hooks.sh
.
These changes indicate a move away from using Git hooks for branch management.
3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! :)
#6404
Used a Git hook
(pre-push)
to prevent pull requests from being created from the main branch.pre-push hook ref: https://git-scm.com/docs/git-push