Split and recombine a Git repository with submodules

8 steps · about 2 h 35 min · Intermediate

  1. Understand the superproject pointer (guide, Pro Git, 35 min)

    See that the parent records one exact child commit rather than embedding the child working tree.

  2. Map the submodule commands (reference, Git documentation, 24 min)

    Use add, status, init, update, sync and deinit with a clear model of their scope.

  3. Learn the stored configuration (reference, Git documentation, 22 min)

    Distinguish the tracked .gitmodules file from local configuration and internal Git directory data.

  4. Review paths, URLs and update policy (reference, Git documentation, 18 min)

    Keep repository locations and optional branch or update choices visible in code review.

  5. Clone before adding nested dependencies (guide, GitHub Docs, 14 min)

    Begin from a complete local superproject and verify its remote before introducing independently versioned content.

  6. Review pointer movement (reference, Git documentation, 14 min)

    Inspect the child commit recorded by a parent pointer update instead of accepting an opaque hash change.

  7. Fetch child history deliberately (reference, Git documentation, 12 min)

    Control recursive fetching while preserving warnings that protect unavailable or uncommitted child work.

  8. Remove the tracked path cleanly (reference, Git documentation, 16 min)

    Delete the submodule entry and path in a reviewable change, then inspect remaining local metadata before cleanup.