Introduction
no-mistakes is a lightweight Go CLI that wraps git push with configurable safety checks. It prevents common mistakes like pushing to protected branches, pushing uncommitted changes, or force-pushing without confirmation, acting as a guardrail for teams and solo developers.
What no-mistakes Does
- Intercepts git push and runs configurable pre-push validations
- Blocks pushes to protected branches (main, master, production)
- Requires confirmation for force pushes and branch deletions
- Validates commit messages against configurable patterns
- Checks for uncommitted changes and untracked sensitive files
Architecture Overview
no-mistakes installs as a git hook wrapper in Go. When a push is initiated, it intercepts the command, runs the configured validation chain, and either allows or blocks the operation with a clear error message. Configuration is stored in a project-level YAML file or global config, and the tool operates entirely locally with zero network dependency.
Self-Hosting & Configuration
- Install via go install or download a pre-built binary
- Run no-mistakes init in a repository to set up git hooks
- Configure protected branches in .no-mistakes.yaml at the repo root
- Global rules can be set in ~/.config/no-mistakes/config.yaml
- Works alongside existing git hooks without conflicts
Key Features
- Zero-dependency single binary written in Go
- Protects against accidental pushes to sensitive branches
- Configurable commit message validation patterns
- Force-push confirmation with explicit acknowledgment
- Sensitive file detection (prevents pushing .env, credentials)
Comparison with Similar Tools
- Husky — JS git hooks manager; no-mistakes is language-agnostic and focused on push safety
- pre-commit — general hook framework; no-mistakes is specialized for push protection
- Lefthook — fast hook runner; no-mistakes adds branch protection and sensitive file detection
- git-secrets — AWS secret scanning; no-mistakes covers broader push safety beyond secrets
FAQ
Q: Does it work with all git hosting platforms? A: Yes, it operates at the local git level and is platform-agnostic.
Q: Can I bypass the checks in an emergency? A: Yes, an explicit flag allows bypassing with a warning logged.
Q: Does it slow down normal pushes? A: Checks run in milliseconds; there is no noticeable delay for standard pushes.
Q: Can teams share configuration? A: Yes, commit .no-mistakes.yaml to the repository for shared team rules.