-
Notifications
You must be signed in to change notification settings - Fork 4
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
The pre-commit.protect-master should protect more than just master #8
base: master
Are you sure you want to change the base?
Conversation
if [ "`git rev-parse --abbrev-ref HEAD`" = "master" ]; then | ||
echo "FATAL ERROR: You cannot commit directly to the master branch." | ||
echo "Commit to a deploy branch instead:" | ||
echo " https://khanacademy.org/r/git-at-ka" |
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.
this link went nowhere...
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.
Thank you for adding main
! I don't know about deploy
or next
but they seem plausible to me.
Adding the deploy branches also makes a lot of sense. Hopefully that will avoid some tsuris.
for branch in $KNOWN_DEPLOY_BRANCHES; do | ||
if [ "$CURRENT_BRANCH" = "$branch" ]; then | ||
echo "FATAL ERROR: You cannot commit directly to the $CURRENT_BRANCH branch." | ||
echo "Make a pull-request (or audit) and land it to this branch instead" |
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.
Maybe: "You cannot commit directly to the ... branch because you've told OLC it's a deploy branch." And also give instructions on how to tell OLC it's not a deploy branch, if that was in error.
Summary:
Now it stops users from accidentally committing to
main
, a few other known branches (for mobile) and any of their target/deploy branches.This can stop people from accidentally committing straight to a deploy branch, which 95% of the time, you never want to do. Can always just
git commit -n
if they reallllly need to get around it (But they never should!! security reasons!! committing directly to a deploy branch bypasses PRs!! They should use an audit if they have to...)Issue: FEI-5966
Test plan:
main