agentleFS
waynesuttonwaynesutton/markdown-site/.cursor/rules/gitruels.mdc

markdown-site / rules

Cursor rule628 starsChanged 7 months agoMITView on GitHub

description: Critical Git Safety Protocol globs: alwaysApply: true 🚨 NEVER USE git checkout TO REVERT CHANGES 🚨 MANDATORY GIT SAFETY RULES: Why this matters: Using git checkout blindly can destroy sophisticated implementations, complex prompts, provider-specific logic, and other valuable work that took significant time to develop. NEVER run these commands without explicit user approval: ALWAYS before any git operation: If user asks to "revert" something: This rule exists because careless git operations destroyed 2 days of work.

  • Deletes or force-pushes

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this gitruels.mdc into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • β‰ˆ0

    Common Β· estimate

    Many files like this have a rule of this kind.

  • β‰ˆ3

    Distinctive Β· estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When user asks to "undo" changes: Read the current file, identify problematic sections, and manually edit to fix them

    line 26
  2. Distinctive:

    Run git status first to check for uncommitted changes

    line 41
  3. Distinctive:

    If there are uncommitted changes, STOP and ASK the user before proceeding

    line 42

β‰ˆ β€œCommon” is an estimate: at least 1 in 5 of the 6,668 Cursor rule files we read have a rule of the same kind, not the same words. β€œVery specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
gitruels.mdc
---
description:
globs:
alwaysApply: true
---

---

description: Critical Git Safety Protocol
globs:
alwaysApply: true

---

## Critical Git Safety Protocol

**🚨 NEVER USE `git checkout` TO REVERT CHANGES 🚨**

**MANDATORY GIT SAFETY RULES:**

- **NEVER run `git checkout -- <file>`** without first examining what you're about to destroy
- **ALWAYS use `git diff <file>`** to see exactly what changes will be lost
- **MANUALLY undo changes** by editing files to revert specific problematic sections
- **Preserve valuable work** β€” if user says changes are bad, ask which specific parts to revert
- **`git checkout` destroys ALL changes** β€” this can eliminate hours of valuable progress
- **When user asks to "undo" changes**: Read the current file, identify problematic sections, and manually edit to fix them

**Why this matters**: Using `git checkout` blindly can destroy sophisticated implementations, complex prompts, provider-specific logic, and other valuable work that took significant time to develop.

## Git Safety Rules - CRITICAL

**NEVER run these commands without explicit user approval:**

- `git reset --hard` - Destroys uncommitted changes permanently
- `git checkout -- .` - Discards all working directory changes
- `git clean -fd` - Deletes untracked files permanently
- `git stash drop` - Deletes stashed changes

**ALWAYS before any git operation:**

1. Run `git status` first to check for uncommitted changes
2. If there are uncommitted changes, STOP and ASK the user before proceeding
3. Suggest `git stash` to preserve changes if needed

**If user asks to "revert" something:**

1. First clarify: revert committed changes or uncommitted changes?
2. Show what will be affected before doing anything
3. Get explicit confirmation for destructive operations

This rule exists because careless git operations destroyed 2 days of work.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.