It seems a git repo inside a parent repo isn’t included in a commit on the parent unless it’s setup as a submodule. Is it possible to override this behaviour and treat the nested git repo as any other directory? I don’t want to rely on external dependencies through submodules but want to use git to manage these dependencies within the project.
Share
1/ You could override that through:
$GIT_DIRyou define your
.gitdirectory of the nested Git working tree as an external.git(external to both the nested repo and the main repo)Set the path to the root of the work tree. This can be overridden by the
GIT_WORK_TREEenvironment variable and the--work-treecommand line optionIn both case, the idea is to have a nested worktree without any
.gitsubdirectory in it.2/ With submodules, the nested git repo is not really included in the parent repo.
A special entry is made in the parent tree to record the external Git SHA1.
See also “nature of Git submodules” (third part of the answer)
Nine years later, this discussion is quite clear:
Brian m. Carlson (
bk2204) answers: