Skip to content

fix: restrict no-commit-to-branch to pre-commit stage only#2

Merged
PKramek merged 1 commit intodevelopfrom
fix/pre-commit-stages
Apr 2, 2026
Merged

fix: restrict no-commit-to-branch to pre-commit stage only#2
PKramek merged 1 commit intodevelopfrom
fix/pre-commit-stages

Conversation

@PKramek
Copy link
Copy Markdown
Owner

@PKramek PKramek commented Apr 2, 2026

Running no-commit-to-branch at pre-push time is architecturally wrong. By the time a push runs, the commit already exists locally — blocking the push doesn't undo it, it just prevents delivery. The hook only makes sense at the commit stage where it can actually stop the commit from being created.

This was surfaced when doing the fast-forward merge of develop → main: the pre-push hook fired and blocked the push because the current branch was main.

Running this hook at pre-push stage is architecturally wrong: by push
time the commit already exists locally, so blocking the push doesn't
undo anything. The guard only makes sense at commit time.
@PKramek PKramek merged commit 5764873 into develop Apr 2, 2026
31 checks passed
@PKramek PKramek deleted the fix/pre-commit-stages branch April 2, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant