Search code examples
gitgit-submodules

Is it possible to inline the contents of a git submodule?


I'd like to use git submodules to track subprojects. I'd also like to have the subprojects' code directly contained in the parent repo, for convenience. Is it possible to inline a submodule such that the parent repo contains a snapshot of the child repo's content at the submodule's commit?


Solution

  • Not with submodules. Submodules are always separate repositories.

    Try git subtree. It allows exactly that — to inline a repository inside another. Then you can decide if want to push changed files back to the source repository.