我有一个代码库,我想在其中添加另一个回购作为子模块来进行一些集成测试。因此,按照教程我跑了
git submodule add -b master [email protected]:kramer65/whisky.git
之后,git status
给了我这个:
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitmodules
whisky/
nothing added to commit but untracked files present (use "git add" to track)
您可以看到.gitmodules
文件是新文件,但whisky/
文件夹也显示为未跟踪。此后,我提交了.gitmodules
文件,但whisky/
文件夹仍然显示为未跟踪。
我该如何处理?我是否还需要将whisky/
文件夹添加到“主机存储库”中?还是我需要将其添加到.gitignore
?还是有其他方法可以解决这个问题?
欢迎所有提示!
只需重新运行git submodule add <URL>
。
Git将把whisky /作为子模块,并且不会跟踪其文件。
您可以通过git diff --cached whisky/
进行检查(git只会将其视为特定的提交)
毕竟,只需提交即可。