# How to Disable no-mistakes for a Specific Branch or Commit

> Learn workarounds to disable no-mistakes for specific branches or commits. Bypass the hook or use global settings to skip validation on select work.

- Repository: [Kun Chen/no-mistakes](https://github.com/kunchenguid/no-mistakes)
- Tags: how-to-guide
- Published: 2026-06-28

---

**The `no-mistakes` gate does not support disabling validation for individual branches or commits.** Because the tool intentionally loads [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml) only from the default branch to prevent supply-chain attacks, you must use global workarounds or bypass the hook entirely to skip validation for specific work.

The `kunchenguid/no-mistakes` repository provides a pre-push quality gate that validates every commit before it reaches the remote. If you need to disable `no-mistakes` for a specific branch or commit, you will encounter a deliberate architectural limitation: the tool's security model treats all per-branch configuration as untrusted, making granular opt-outs impossible without circumventing the gate completely.

## Why Per-Branch Configuration Is Blocked

The tool's daemon logic explicitly ignores configuration files that exist on feature branches. In [`internal/daemon/manager.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/daemon/manager.go), the gate fetches and parses [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml) exclusively from the repository's default branch:

```go
if err := repo.FetchDefaultBranch(); err != nil {
    slog.Warn("failed to fetch default branch; trusted config disabled")
    // At this point the gate will operate with its default behavior,
    // ignoring any .no-mistakes.yaml that might exist on the pushed branch.
}

```

This design prevents supply-chain attacks where a malicious actor could commit a disabled configuration to a feature branch and bypass quality checks. As documented in [`AGENTS.md`](https://github.com/kunchenguid/no-mistakes/blob/main/AGENTS.md), this security boundary means any attempt to add a `disable: true` flag to a feature branch's [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml) will be ignored by the gate.

## Three Methods to Bypass Validation

While you cannot configure branch-specific exceptions, you can bypass the gate entirely using these three approaches.

### Push Directly to Remote (Bypass the Hook)

The most straightforward method is to bypass the local gate by pushing directly to the remote repository. This circumventes `no-mistakes` because the tool operates as a local pre-push hook or daemon that intercepts standard `git push` commands.

```bash

# Bypass the gate entirely by pushing straight to origin

git push origin feature-branch-name

```

When you push directly to the remote URL, the local `no-mistakes` process is never invoked, so no validation pipeline runs. This is the only way to completely skip the gate for a specific branch without modifying global settings.

### Temporarily Disable Auto-Fix Globally

You can neuter the gate's automatic remediation by setting all `auto_fix` values to `0` (disabled) in your user-level configuration. This does not stop the pipeline from running, but it forces every finding to be handled manually, effectively making the gate a no-op for automated fixes.

Edit your user configuration file (typically `$HOME/.config/no-mistakes/config.yaml`):

```yaml
auto_fix:
  lint: 0
  test: 0
  ci:   0

```

According to [`internal/config/config.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/config/config.go), these global settings apply to the entire repository, not individual branches. This change affects every push until you revert the values, so use this method only when you need temporary repository-wide suppression.

### Keep Changes Local Until Ready

If you need to avoid triggering the gate for work-in-progress, maintain your changes in a local branch without pushing. The `no-mistakes` gate only activates during push operations, so commits that remain local never undergo validation.

```bash

# Work locally without triggering the gate

git checkout -b local-only-feature

# Make commits...

# Only push when ready for validation

git push origin local-only-feature

```

This approach respects the tool's security model while allowing you to delay validation until your code is ready for review.

## Technical Implementation Details

The gate's configuration architecture in [`internal/config/config.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/config/config.go) defines global flags such as `auto_fix`, `intent`, and disabled readers that apply universally across the repository. There is no interface in [`cmd/no-mistakes/main.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/no-mistakes/main.go) to accept CLI flags like `--disable` or `--skip-branch` that would override behavior for a single push.

The security model implemented in [`internal/daemon/manager.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/daemon/manager.go) deliberately discards branch-specific configuration to ensure that an attacker cannot compromise the pipeline by modifying files on a feature branch. Consequently, the `FetchDefaultBranch()` method only trusts the default branch's copy of the configuration, rendering any per-commit disable flags inert.

## Summary

- **Per-branch disabling is architecturally impossible** because `no-mistakes` loads [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml) exclusively from the default branch to prevent supply-chain attacks.
- **Push directly to remote** to bypass the gate entirely for a specific branch without affecting global settings.
- **Set `auto_fix` to `0`** in your user config to disable automatic remediation repository-wide.
- **Keep work local** to defer validation until you are ready to push.
- **No CLI flags exist** in [`cmd/no-mistakes/main.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/no-mistakes/main.go) to disable the gate for individual commits or branches.

## Frequently Asked Questions

### Can I add a disable flag to .no-mistakes.yaml on my feature branch?

No. The daemon in [`internal/daemon/manager.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/daemon/manager.go) explicitly ignores any [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml) file that exists on a feature branch, loading configuration only from the default branch. This security measure prevents malicious configuration changes from bypassing quality checks.

### Is there a --disable or --skip flag for the CLI?

No. The entry point in [`cmd/no-mistakes/main.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/no-mistakes/main.go) does not expose command-line flags to disable the gate for specific branches or commits. The tool is designed to validate every push that passes through it, with behavior controlled only by global configuration options.

### Why does no-mistakes ignore my branch's configuration file?

The tool treats feature branches as potentially compromised. According to the logic in [`internal/daemon/manager.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/daemon/manager.go) and the security documentation in [`AGENTS.md`](https://github.com/kunchenguid/no-mistakes/blob/main/AGENTS.md), parsing configuration from non-default branches would create a supply-chain vulnerability where attackers could disable security checks by committing modified configuration files.

### Will pushing directly to origin bypass all checks?

Yes. Executing `git push origin <branch>` directly bypasses the local `no-mistakes` hook or daemon entirely. This prevents the validation pipeline from running for that specific push operation, though it means no automated quality checks will be performed on your code.