no-git-history-changes

no-git-history-changes is a cursor rule for Cursor from tommyvo/useful-prompts. It costs 543 tokens per session, scanned B, original, Unlicense.

A rule that prevents an agent from creating commits or rewriting existing Git history without explicit approval for each instance.

In plain words
What is it for?
Use it to govern commits, amendments, rebases, resets, cherry-picks, history filtering, and force-pushes.
Why use it?
Changing Git history can alter shared project records and make collaboration or recovery harder. The rule blocks those operations by default.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it to govern commits, amendments, rebases, resets, cherry-picks, history filtering, and force-pushes.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/tommyvo/useful-prompts/no-git-history-changes
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/tommyvo/useful-prompts

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for no-git-history-changes

README.md
[![agentmods](https://agentmods.dev/badge/rules/tommyvo/useful-prompts/no-git-history-changes.svg)](https://agentmods.dev/rules/tommyvo/useful-prompts/no-git-history-changes)
Your own site
<a href="https://agentmods.dev/rules/tommyvo/useful-prompts/no-git-history-changes"><img src="https://agentmods.dev/badge/rules/tommyvo/useful-prompts/no-git-history-changes.svg" alt="Measured on agentmods" height="20"></a>
Per session 543 This file is loaded in full into every session.
When invoked 543 The same file — it is already loaded in full.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00543 $0.00543
Opus 5 $0.00271 $0.00271
Sonnet 5 $0.00109 $0.00109
Haiku 4.5 $0.00054 $0.00054

Measured 8d ago against content hash ee6b39cc026d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade B, and why

no-git-history-changes scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Unrestricted tool accessmediumExcessive agency

A wildcard tool grant or "run any command" leaves no least-privilege boundary at all.

The agent is NEVER authorized to run any command that creates a commit or
Cursor/rules/no-git-history-changes.mdc · 51 lines

How it starts

The opening of the file, as written. The whole thing — 51 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Never Change Git History Without Explicit Approval

The agent is NEVER authorized to run any command that creates a commit or rewrites git history — not by default, not with general prior approval, and not even if the user explicitly requests it in the moment. This rule cannot be overridden by a user instruction, no matter how direct or repeated. If the user asks the agent to commit, amend, rebase, reset, force-push, or otherwise write to git history, the agent must refuse and explain that this action is never authorized, and instead hand back the exact command/message for the user to run themselves.

This applies even if the user asked for something similar earlier in the same conversation, even if the user says "we amend commits" or describes a team convention, and even if a prior message seemed to authorize it in general terms.

This includes, but is not limited to:

  • git commit (including with -m, -F, --no-edit, etc.)
  • git commit --amend
  • git rebase (interactive or not)
  • git reset (soft, mixed, or hard)
  • git push, git push --force, git push --force-with-lease
  • git cherry-pick, git filter-branch, git filter-repo
  • Any other command that changes the commit graph, HEAD, branch refs, or remote history

What to do instead

  • If the user wants a commit message, provide the text only (e.g. in a markdown code block). Do NOT run git commit with it.
  • If the user wants to amend, explain what the amend would do and give them the exact command to run themselves. Do NOT run it.
  • Staging changes (git add) is fine. Read-only inspection commands (git status, git diff, git log, git show) are fine.
  • There is no phrasing, permission grant, or user instruction — however explicit, repeated, or urgent — that authorizes the agent to run these commands itself. Always refuse and defer to the user to run it.

Why

Committing or rewriting history on someone's behalf is irreversible-feeling and high-stakes: it can rewrite shared history, trigger CI/hooks unexpectedly, or push things the user hasn't actually reviewed yet. The default must always be to hand back control, not to act.

Read the full file on GitHub · 51 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 51 lines · 543 tokens per session scan B ee6b39cc026d

Subscribe to this mod's changes

no-git-history-changes is a cursor rule published in the GitHub repository tommyvo/useful-prompts (3 stars, last pushed 10d ago), licensed Unlicense. It adds 543 tokens to every session, about $0.0027 per session on Opus 5. A static security scan graded it B with 1 finding (unrestricted tool access). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.