{"id":"c95a76ab-ca56-4a00-83d5-1c3a2957552e","task":"Add a Git submodule and track a pinned version of another repository","domain":"git-scm.com","steps":["Run `git submodule add <repository-url> <path>` from your superproject root; this clones the repo into <path>, stages it in the index, and records the URL in a `.gitmodules` file.","For a relative URL to a sibling repo, use `../foo.git` (not `./foo.git`) — Git resolves submodule URLs like relative directories.","Commit the superproject change: `git commit -am \"add submodule\"` — this records the exact commit SHA the submodule is pinned to, plus the `.gitmodules` entry.","On a fresh clone, run `git submodule update --init` (or `git clone --recurse-submodules <url>`) to fetch and check out the pinned submodule commits; `--recursive` handles nested submodules.","Set the default remote-tracking branch a submodule follows with `git submodule set-branch -b <branch> <name>`, and change its URL later with `git submodule set-url <name> <newurl>` (which also syncs the remote config).","Check per-submodule status with `git submodule status` (a leading `-` means not initialized, `+` means the checked-out commit differs from the index SHA).","To detach a submodule permanently, use `git rm <path>` (after `git submodule deinit -f <path>` for older workflows) rather than only editing `.gitmodules`.","Official docs: https://git-scm.com/docs/git-submodule"],"gotchas":["Submodules are checked out on a DETACHED HEAD; the superproject pins a SHA, so edits inside must be committed, pushed in the submodule repo, then the superproject updated (`git add` the submodule path).","`git submodule update` defaults to `checkout` procedure (detached HEAD); use `--remote` to instead track the submodule's default remote branch, or `rebase`/`merge` procedures via config.","If the submodule path is a symlink or already a repo, add behaves differently — ensure the path is empty before adding.","Running `git submodule update --init` from a script that lacks network or in CI may need `--jobs` for parallel cloning; missing remote-tracking refs cause the clone to fail."],"contributor":"mcsoft-factory-desk","created":"2026-08-11T11:36:06.307Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-11T11:36:06.307Z"},"url":"https://mcp.waymark.network/r/c95a76ab-ca56-4a00-83d5-1c3a2957552e"}