Repository navigation
feat(git): refuse a push that does not hold origin/main - #4879
Conversation
Verification and measurementsLocal runs on the branch (devcontainer, git 2.55.0, pre-commit 4.6.2; the host load was 25 to 77 during the whole session):
Dogfood: this branch was pushed with Hook time: Pending a person
|
881888d to
75516b7
Compare
787f291 to
05fa20b
Compare
Rebuild in the small form (owner feedback of 2026-11-12)The owner said: "pr 4879 seems like a really complicated alternative to the precommit hook check-merge-conflict". The first head ( A merge of Evidence
Steps for a personNone. After the merge, |
The pre-push hook branch-current fetches main of origin and refuses a push of a branch that does not hold it, with the fix `git fetch origin && git rebase origin/main`. A branch that holds origin/main merges cleanly, so this one check covers the push rule. The implement Job pushes nothing after a rebase conflict: push_on_conflict and the conflict push of _current_tip are removed.
230fdae to
47ab7e4
Compare
Second head after the first CI runThe first run of the required checks found 4 tests that read the pre-push hooks. The head
Local runs on this head: Twice, a GitHub "Update branch" merge of |
🤖 I have created a release *beep* *boop* --- ## [0.117.0](v0.116.2...v0.117.0) (2026-11-12) ### Features * **git:** refuse a push that does not hold origin/main ([#4879](#4879)) ([f55a20b](f55a20b)), closes [#4670](#4670) ### Bug Fixes * **k8s:** replace the SearXNG worker before its memory limit ([#4951](#4951)) ([95abe10](95abe10)) * **mcp:** mark the tools that write local state not read-only ([#4942](#4942)) ([6d93d77](6d93d77)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
|
Review findings after the merge:
About the question "is this a complicated alternative to |
Each push to GitHub must hold the latest
origin/mainand merge cleanly. A branch that holdsorigin/mainalways merges cleanly intomain, so one git check covers the rule.branch-current, is a few lines ofsh. It fetchesmainoforiginand refuses a branch push whengit merge-base --is-ancestor FETCH_HEAD <pushed commit>fails, with the fixgit fetch origin && git rebase origin/main. A tag, a delete and the scoped run of the implement Job pass.check-merge-conflictstays: it finds conflict markers, not a branch behindmain.push_on_conflictand the conflict push of_current_tipare removed.devops ai agentsnames a local hook withargsby itsid, so it showsbranch-current, notsh -c.devops pr update, the main source of catch-up pushes.Closes #4670
Change:
openspec/changes/archive/2026-11-12-4670-push-gate/