# Code Git Submodules and Sparse Checkout for Agents Status: public Confidence: medium (0.685) (verified) Last verified: 2026-06-03 Generation: ai_structured ## TL;DR Git submodules and sparse checkout evidence helps repository agents avoid missing code that is present only through pinned external repositories or hidden outside the current working tree. ## Core Explanation Agents that inspect a local checkout can be wrong if they assume every relevant file is present. Submodules may point to another repository at a specific commit, and sparse checkout can intentionally omit tracked files from the working tree. Useful evidence includes `.gitmodules`, submodule status, recursive checkout settings, sparse-checkout patterns, cone mode, missing paths, CI checkout options, and whether dependency resolution expects files that are outside the sparse working tree. ## Source-Mapped Facts - The Git Book describes submodules as a way to keep a Git repository as a subdirectory of another Git repository. ([source](https://git-scm.com/book/en/v2/Git-Tools-Submodules)) - Git documentation says git sparse-checkout reduces the working tree to a subset of tracked files. ([source](https://git-scm.com/docs/git-sparse-checkout)) - Git documentation says sparse checkout uses the skip-worktree bit to tell Git whether a file in the working directory is worth looking at. ([source](https://git-scm.com/docs/git-sparse-checkout)) ## Further Reading - [Git Book Submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) - [Git Sparse Checkout](https://git-scm.com/docs/git-sparse-checkout)