Thoughts on adding https://github.com/blog/2051-protected-branches-and-required-status-checks?
-
dcousens commented at 12:50 AM on September 19, 2015: contributor
-
dexX7 commented at 9:19 AM on September 19, 2015: contributor
That's a really cool feature!
After a (legit) forced push, there is even a hint:

And once the guard is enabled, it's visible to anyone:

This is the message returned, when trying to force a push to a locked branch:
/tmp/protected-branch-test$ git push origin master -f Counting objects: 1, done. Writing objects: 100% (1/1), 205 bytes | 0 bytes/s, done. Total 1 (delta 0), reused 0 (delta 0) remote: error: GH006: Protected branch update failed for refs/heads/master. remote: error: Cannot force-push to a protected branch To https://github.com/dexX7/protected-branch-test.git ! [remote rejected] master -> master (protected branch hook declined) error: failed to push some refs to 'https://github.com/dexX7/protected-branch-test.git'And if the CI tests fail, merges via git web, or command-line are blocked as expected.
I tested it with the
github-merge.shscript:Type 'push' to push the result to git@github.com:dexX7/protected-branch-test, branch master. push Counting objects: 1, done. Writing objects: 100% (1/1), 910 bytes | 0 bytes/s, done. Total 1 (delta 0), reused 0 (delta 0) remote: error: GH006: Protected branch update failed for refs/heads/master. remote: error: Required status check "continuous-integration/travis-ci" is failing To git@github.com:dexX7/protected-branch-test ! [remote rejected] master -> master (protected branch hook declined) error: failed to push some refs to 'git@github.com:dexX7/protected-branch-test'The guard can be disabled at any time.
-
laanwj commented at 8:01 PM on September 22, 2015: member
Ok, tried enabling this for all branches.
- laanwj closed this on Sep 22, 2015
-
gmaxwell commented at 10:49 PM on September 22, 2015: contributor
We do not use github infrastructure for merging as it is incompatible with digital signatures (for the obvious reasons.)
- MarcoFalke locked this on Sep 8, 2021
