git-repo-cleanup

Detect nested git repositories and remove them from tracking with git rm --cached -r.

5|3|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/ZHLX2005/fr --skill git-repo-cleanup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-repo-cleanup
Source: https://github.com/ZHLX2005/fr/tree/main/.claude/skills/git-repo-cleanup
Command: npx skills add https://github.com/ZHLX2005/fr --skill git-repo-cleanup

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Nested git repositories cloned into project directories often pollute the main repository in git's index, leading to dirty status and accidental commits.

Core Features & Use Cases

  • Detect nested repositories within project folders (e.g., .claude/repo/) that would otherwise be tracked or modified by git.
  • Add rules to .gitignore to prevent nested repos from being added to the index.
  • Safely remove already-tracked nested repos using git rm --cached -r and verify a clean working tree.

Quick Start

Add .claude/repo/ to your .gitignore and remove it from git tracking to isolate cloned repositories.

Frequently Asked Questions about git-repo-cleanup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I remove a nested git repository from my project directory?

Remove nested git repositories by adding their paths to .gitignore and running git rm --cached -r to untrack them. This eliminates dirty git status caused by cloned directories polluting the main repository index.

Why does my git status show modified files inside a cloned subfolder?

Git status shows modified files inside cloned subfolders because nested git repositories are tracked by the parent repository's index. Isolate the nested repo by adding it to .gitignore and removing it from tracking with git rm --cached -r.

How do I stop git from tracking files in a nested repository without deleting them?

Stop git from tracking nested repository files without deleting them by running git rm --cached -r on the nested directory path. This removes the files from the git index while keeping them on disk, then add the path to .gitignore to prevent future tracking.

What's the best way to isolate cloned repositories inside a git project?

The best way to isolate cloned repositories inside a git project is to add their directory paths to .gitignore and remove any already-tracked files using git rm --cached -r. This approach safely untracks nested repos while keeping the working tree clean.

How do I verify a clean git working tree after removing a nested repo?

Verify a clean git working tree after removing a nested repo by running git status. Confirm that the previously tracked nested directory no longer appears as modified or untracked, ensuring the repository isolation via .gitignore and git rm --cached -r was successful.

Can I untrack a nested repository if it was already committed to my main git repo?

Yes, you can untrack a nested repository already committed to your main git repo by running git rm --cached -r on the nested directory and adding it to .gitignore. This removes the files from future commits while preserving them locally on disk.