我有3个回购用于跟踪每个回购。
现在,我想跟踪父项目目录。
我在Bitbucket创建了一个新的回购。
转到我的2018 /
clone
add url
commit
push
这就是我在Bitbucket来源中看到的全部内容
如何调整我的git以便跟踪子文件夹?
我试过
git submodule add
⚡️ 2018 git submodule add external/
repo URL: 'external/' must be absolute or begin with ./|../
⚡️ 2018 git submodule add internal/
repo URL: 'internal/' must be absolute or begin with ./|../
⚡️ 2018 git submodule add api/
repo URL: 'api/' must be absolute or begin with ./|../
⚡️ 2018
cd internal/
git submodule add git@bitbucket.org:bhengdev/2018.git
cd ..
cd external/
git submodule add git@bitbucket.org:bhengdev/2018.git
cd ..
cd api/
git submodule add git@bitbucket.org:bhengdev/2018.git
cd ..
git status
⚡️ 2018 git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: api (modified content, untracked content)
modified: external (modified content, untracked content)
modified: internal (modified content)
no changes added to commit (use "git add" and/or "git commit -a")
⚡️ 2018
答案 0 :(得分:1)
如何使用 git子模块?
您可以将每个子文件夹或子项目作为子模块添加到主项目中。
您可以使用git submodule add <repositoryURI> [<path>]
命令添加子项目。
稍后您可以编辑子模块所在的 .gitmodules 文件。
有关配置,请参阅以下页面底部的示例:
Git submodules configuration examples
When cloning or pulling a repository containing submodules
the submodules will not be checked out by default;
You can instruct clone to recurse into submodules. The init
and update subcommands of git submodule will maintain
submodules checked out and at an appropriate revision in
your working tree.
Alternatively you can set submodule.recurse to have checkout
recursing into submodules.
您也可以在每个上手动运行命令:
git submodule foreach 'git pull'
或
git submodule update --init