Agent skill
git-submodule
Add a directory as a git submodule with its own remote repository. Use when user wants to track a directory with separate git history.
Install this agent skill to your Project
npx add-skill https://github.com/goodluckz/claude-code-config/tree/main/skills/git-submodule
SKILL.md
Git Submodule Management
This skill helps convert directories to git submodules or add existing repositories as submodules.
Usage
When the user asks to add a submodule, follow these steps:
Option 1: Convert existing directory to submodule (with new remote)
If the directory already exists and has its own .git:
# 1. Navigate to the directory and commit any changes
cd <directory>
git add -A && git commit -m "chore: prepare for submodule conversion"
# 2. Create private GitHub repo and push
gh repo create <repo-name> --private --source=. --push
# 3. Go back to parent repo and remove the directory
cd <parent-repo>
rm -rf <directory>
# 4. Add as submodule
git submodule add git@github.com:<username>/<repo-name>.git <directory>
# 5. Commit the submodule addition
git commit -m "chore: add <directory> as git submodule"
Option 2: Add existing remote repository as submodule
git submodule add git@github.com:<username>/<repo-name>.git <path>
git commit -m "chore: add <path> as git submodule"
Option 3: Convert untracked directory to submodule
If the directory exists but has no git history:
# 1. Initialize git in the directory
cd <directory>
git init
git add -A
git commit -m "Initial commit"
# 2. Create remote and push
gh repo create <repo-name> --private --source=. --push
# 3. Remove and re-add as submodule (same as Option 1, steps 3-5)
Common Submodule Commands
Clone repo with submodules:
git clone --recurse-submodules <repo-url>
Initialize submodules after clone:
git submodule update --init --recursive
Update submodule to latest:
cd <submodule-path>
git pull origin main
cd ..
git add <submodule-path>
git commit -m "chore: update <submodule-path> submodule"
Remove a submodule:
git submodule deinit -f <path>
git rm -f <path>
rm -rf .git/modules/<path>
git commit -m "chore: remove <path> submodule"
Notes
- Submodules track a specific commit, not a branch
- After updating submodule content, commit in both the submodule AND parent repo
- Use
--recurse-submoduleswith clone/pull for automatic submodule handling
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
amend-staged
Amend the last commit with staged changes only
test00-check
Check test00 honeynet production server status - pcap files, tcpdump processes, containers, and Google Drive sync. Use when user wants to check test00 data or server health.
commit-staged
Git commit commands for staged-only commits
dagster-remote
Manage remote Dagster server on dns-analy4 - start, stop, restart, check status, sync code, and view logs. Use when user wants to manage the remote Dagster deployment.
arkime-tag-manager
Manage Arkime session tags (add/remove) using API
arkime-data-manager
Manage Arkime data (wipe database, import PCAPs)
Didn't find tool you were looking for?