This skill establishes a nested Git repository structure (Monorepo) where the outer (parent) repository physically tracks and stores the source code of an inner (child) repository, without using the standard Git Submodule mechanism. This allows the child repository to retain its own .git directory for independent committing and pushing.
When to Use
When migrating an existing Git repository to be embedded within a parent Monorepo.
When the parent repository needs full direct physical access to the child's source files.
When you need to avoid "empty folder" issues caused by standard Git submodules during cloning.
When you want to commit and push independently from both the parent root and the child root.
Step-by-Step Process
Step 1: Remove Submodule References (If Any)
Ensure the inner repository is not tracked as a submodule.
Run git rm -r --cached <child-folder> from the parent root.
Remove .gitmodules if it exists: rm .gitmodules and git add .gitmodules (if tracked).
Step 2: Temporary .git Relocation
Move the inner repository's .git directory out of the way to prevent Git from treating it as an embedded repo.
Run mv <child-folder>/.git /tmp/<child-name>_git_bak.
Step 3: Embed Source Code into Parent
Add the inner folder directly to the parent repository.
Run git add <child-folder>/.
Commit the changes: git commit -m "Embed full source of <child-name> independent of submodule".
Step 4: Restore Independent .git
Move the inner repository's .git directory back to its original location.
Run mv /tmp/<child-name>_git_bak <child-folder>/.git.
Step 5: Verification
Run git status in the parent directory to ensure no submodule links are shown.
Navigate into <child-folder> and run git status to verify the independent repository tracking is intact.
Required Input
Child folder path: The relative path to the nested repository.
Child name: A short identifier used for the backup directory.
Expected Output
The parent's remote repository will contain all physical files natively without gitlinks.
The child folder will retain its .git folder for completely independent repository operations.
Tone & Rules
Git Rules
The child folder's .gitignore MUST be preserved, as the parent git will natively respect .gitignore rules in subdirectories.
Ensure all uncommitted changes in the parent repo are stashed or committed before starting.
Limitations
❌ DO NOT use git submodule add under any circumstances for this skill.
❌ DO NOT delete the inner .git folder permanently.
❌ DO NOT use git subtree as it creates a different tracking model.
1---2name: git-embed3description: Skill: Git Embed4---5# Skill: Git Embed67## Purpose89This skill establishes a nested Git repository structure (Monorepo) where the outer (parent) repository physically tracks and stores the source code of an inner (child) repository, without using the standard Git Submodule mechanism. This allows the child repository to retain its own `.git` directory for independent committing and pushing.1011## When to Use1213- When migrating an existing Git repository to be embedded within a parent Monorepo.14- When the parent repository needs full direct physical access to the child's source files.15- When you need to avoid "empty folder" issues caused by standard Git submodules during cloning.16- When you want to commit and push independently from both the parent root and the child root.1718## Step-by-Step Process1920### Step 1: Remove Submodule References (If Any)21- Ensure the inner repository is not tracked as a submodule.22- Run `git rm -r --cached <child-folder>` from the parent root.23- Remove `.gitmodules` if it exists: `rm .gitmodules` and `git add .gitmodules` (if tracked).2425### Step 2: Temporary `.git` Relocation26- Move the inner repository's `.git` directory out of the way to prevent Git from treating it as an embedded repo.27- Run `mv <child-folder>/.git /tmp/<child-name>_git_bak`.2829### Step 3: Embed Source Code into Parent30- Add the inner folder directly to the parent repository.31- Run `git add <child-folder>/`.32- Commit the changes: `git commit -m "Embed full source of <child-name> independent of submodule"`.3334### Step 4: Restore Independent `.git`35- Move the inner repository's `.git` directory back to its original location.36- Run `mv /tmp/<child-name>_git_bak <child-folder>/.git`.3738### Step 5: Verification39- Run `git status` in the parent directory to ensure no submodule links are shown.40- Navigate into `<child-folder>` and run `git status` to verify the independent repository tracking is intact.4142## Required Input4344- **Child folder path**: The relative path to the nested repository.45- **Child name**: A short identifier used for the backup directory.4647## Expected Output4849- The parent's remote repository will contain all physical files natively without gitlinks.50- The child folder will retain its `.git` folder for completely independent repository operations.5152## Tone & Rules5354### Git Rules55- The child folder's `.gitignore` MUST be preserved, as the parent git will natively respect `.gitignore` rules in subdirectories.56- Ensure all uncommitted changes in the parent repo are stashed or committed before starting.5758### Limitations59- ❌ DO NOT use `git submodule add` under any circumstances for this skill.60- ❌ DO NOT delete the inner `.git` folder permanently.61- ❌ DO NOT use `git subtree` as it creates a different tracking model.
Run npx skillmds@latest add polyxgo/git-embed in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Skill: Git Embed It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
PolyXGO (@polyxgo) published this skill. Their other Agent Skills are listed on their SkillMD profile.