How to make top-level git to track all the files under another sub-directory git

后端 未结 1 1414
隐瞒了意图╮
隐瞒了意图╮ 2020-12-29 12:55

command sequence

mkdir topdir
mkdir another-git-directory
touch fileC
touch fileD
git add .
git commit -m \"sub-dir in

相关标签:
1条回答
  • 2020-12-29 13:22

    A nested repo is by default untracked.
    (actually it tracks the submodule root folder as a gitlink, special entry in the index)
    Git will detect the nested .git repo, and the parent repo will delegate any file status to the nested one.

    To show them tracked, you may have to:

    • remove the gitlink: git rm --cached mysubmodule.
      Note the lack of trailing slash: mysubmodule represents the gitlink, while mysubmodule/ is the folder created by the checked out submodule.
    • add it back to the index of the parent repo: git add mysubmodule (here, you can add or not a trailing slash, it does not matter)
    • commit the new files added and present in mysubmodule.
    0 讨论(0)
提交回复
热议问题