如何调整git设置,使其跟踪子文件夹?

如何调整git设置,使其跟踪子文件夹?,git,bitbucket,Git,Bitbucket,我有3份回购协议,我曾经跟踪过每一份 现在,我想跟踪父项目目录 我在Bitbucket中创建了一个新的回购协议 去我的2018/ clone add url commit push 这是我在Bitbucket源代码中看到的全部内容 如何调整git以使其跟踪子文件夹 我试过了 git子模块添加 ⚡️ 2018 git submodule add external/ repo URL: 'external/' must be absolute or begin with ./|../

我有3份回购协议,我曾经跟踪过每一份

现在,我想跟踪父项目目录

我在Bitbucket中创建了一个新的回购协议

去我的2018/

clone
add url 
commit
push
这是我在Bitbucket源代码中看到的全部内容

如何调整git以使其跟踪子文件夹


我试过了

git子模块添加

⚡️  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  

更新
git状态
⚡️  2018年吉特状态
论分行行长
您的分支机构是最新的“原始/主”分支机构。
未为提交而暂存的更改:
(使用“git add…”更新将提交的内容)
(使用“git签出--…”放弃工作目录中的更改)
(提交或放弃子模块中未跟踪或修改的内容)
修改:api(修改内容、未跟踪内容)
已修改:外部(已修改内容、未跟踪内容)
修改:内部(修改内容)
未向提交添加任何更改(使用“git add”和/或“git commit-a”)
⚡️  2018

使用git子模块怎么样

您可以将每个子文件夹或子项目作为子模块添加到主项目中

您可以使用
git submodule add[]
命令添加子项目

稍后,您可以编辑.gitmodules文件,该文件的子模块位于哪个位置

有关配置,请参见下页底部的示例:

您还可以对以下各项手动运行命令:

git子模块foreach'git pull'


git子模块更新--init

它似乎不起作用。我用结果更新了我的帖子。你还有其他建议吗?是的,我也更新了命令。检查git帮助子模块以获取帮助。您还可以为每个子模块存储库指定远程url。“子模块”命令为您提供了一个更新子文件夹内容或显示其状态的界面。我仍然有这个问题
(已修改的内容,未跟踪的内容)
您知道如何修复它吗?也许这就是您的答案:该链接上接受的答案非常混乱!:(你还是希望这三个文件夹都是他们自己的回购协议,还是你可以接受一个回购协议?我不知道最好的方法是什么。这是我第一次这么做。现在,我希望这三个文件夹仍然是it拥有的回购协议。1.
git子模块add
应该在最上面的主项目.api中运行,外部和外部内部可以是您的原始git存储库克隆。2.不要
git将这些文件夹添加到主项目中,而只需从主项目运行
git submodule add
命令,它将在那里创建一个.gitmodules文件!
  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
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.