Configs2026年7月21日·1 分钟阅读

no-mistakes — Git Push Safety Guard

Lightweight CLI tool that prevents accidental git pushes by enforcing pre-push checks, branch protection rules, and confirmation prompts.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
no-mistakes
直接安装命令
npx -y tokrepo@latest install c0640919-8523-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

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.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产