pre-commit: no-commit-to-branch hook

· Thiago Perrotta · March 21, 2025, 3:41 p.m.
Summary
This blog post discusses a solution to prevent developers from accidentally committing directly to the master or main branch in Git using a pre-commit hook called 'no-commit-to-branch'. The author shares their experience implementing this client-side check via pre-commit and addresses issues encountered in the CI pipeline, concluding that skipping the hook during CI is recommended.