git-submodules
Skill0 starsChanged 39 days agoMITView on GitHub
Use when working with git submodules — cloning, updating, pinning a branch, pushing safely, branch switching that adds/removes submodules, or resolving submodule conflicts
- Deletes or force-pushes
- Commits and pushes
In this repository66 other files it gives its agents.
- AGENTS.mdAGENTS.md
- postgres-locking-joinsSkill
- ai-bug-patternsSkill
- compressed-ndjson-boundariesSkill
- http-resume-integritySkill
- linux-io-latency-triageSkill
- macos-disk-space-recoverySkill
- minimal-sufficient-evidenceSkill
- modularize-large-filesSkill
- patch-reproducer-validitySkill
- prompt-cache-boundariesSkill
- proton-drive-selective-backupSkill
- transactional-outbox-deliverySkill
- conventional-commitsSkill
- git-advanced-mergingSkill
- git-bisect-forensicsSkill
- git-data-recoverySkill
- git-hooksSkill
- git-rerereSkill
- git-reset-mechanicsSkill
- git-revisions-syntaxSkill
- git-rewriting-historySkill
- git-worktreesSkill
- github-ssh-keysSkill
- npm-publish-ci-pitfallsSkill
- sapling-stacked-pr-workflowSkill
- go-concurrency-patternsSkill
- go-data-idiomsSkill
- go-error-handlingSkill
- go-interfaces-embeddingSkill
- go-pprof-profilingSkill
- marketing-funnel-diagnosisSkill
- marketing-geo-experimentsSkill
- marketing-incrementalitySkill
- marketing-positioning-testsSkill
- python-descriptors-mroSkill
- python-logging-cookbookSkill
- python-scaling-regression-testsSkill
- python-unicode-gotchasSkill
- rust-compile-time-invariantsSkill
- rust-deterministic-concurrency-testsSkill
- rust-error-identity-boundariesSkill
- rust-regex-search-contractsSkill
- rust-runtime-bug-classesSkill
- rust-tokio-actor-deliverySkill
- rust-tokio-cancellation-safetySkill
- sales-discovery-qualificationSkill
- sales-mutual-action-plansSkill
- sales-pipeline-forecast-calibrationSkill
- sales-value-negotiationSkill
- ai-triage-evaluationSkill
- container-image-patchingSkill
- dependency-artifact-integritySkill
- dnssec-sentinel-diagnosticsSkill
- iam-policy-change-replaySkill
- rbvm-applicabilitySkill
- rbvm-asset-evidenceSkill
- rbvm-guarded-remediationSkill
- rbvm-priority-decisionsSkill
- rbvm-risk-exceptionsSkill
- The first 60 shown.
The file
Files
Git Submodules
A submodule pins a specific commit of an external repo. .gitmodules stores URL+path; the super tree records the SHA as a gitlink.
Cloning
git clone --recurse-submodules <url> # preferred
git submodule update --init --recursive # after a plain clonePlain clone creates empty dirs. update without --init silently skips new ones.
Default Update = Detached HEAD
git submodule update checks out the pinned SHA detached. Work there is lost on next update unless committed to a branch.
Proper edit flow:
cd sub && git checkout main
# edit, commit, push from inside sub first
cd .. && git add sub && git commit # bump super pinTrack a Branch
git config -f .gitmodules submodule.sub.branch main
git submodule update --remote --merge # fetch + merge
git submodule update --remote --rebase # fetch + rebase--remote alone drops to detached HEAD — loses local work.
Global Defaults
git config --global submodule.recurse true # applies to pull/checkout/reset (NOT clone)
git config --global push.recurseSubmodules check
git config --global status.submodulesummary 1Push Safety
git push --recurse-submodules=check # fail if sub commits unpushed
git push --recurse-submodules=on-demand # push subs firstWithout this you push a super pointing to a SHA that doesn't exist remotely.
Batch
git submodule foreach 'git fetch --all'
git submodule foreach --recursive 'git status -sb'Conflicts & URL Moves
Both sides bumped pin:
cd sub && git merge <their-sha>
cd .. && git add sub && git commit.gitmodules URL changed upstream:
git submodule sync --recursive
git submodule update --init --recursiveRemoving
git submodule deinit -f path/sub
git rm -f path/sub
rm -rf .git/modules/path/subPitfalls
- Forgetting to push the sub before the super — the #1 submodule bug.
submodule.recurse=truedoes not affectgit clone.- Converting a subdir to a submodule:
git rm -r dirthengit submodule add(notrm -rf).
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
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.

