问题描述
可能非常愚蠢的问题,但我一直在.gitmodules文件中指定子模块。它最近让我感到可能只是使用.git / config出于同样的原因,所以我不必在工作目录中保留无关文件?
.git / config:
c $ c> .gitignore 。
.gitmodules 文件可以包含在(和任何普通文件一样可以添加和提交),而 .git 中的任何内容(如 .git / config )是私有的(您不能将其添加到存储库中)。
Probably very silly question, - but I've been specifying submodules up until now in .gitmodules file. It recently struck me that perhaps it's possible to just use .git/config for the same reason so I won't have to keep extraneous file in working directory?
.git/config :
[submodule "path/to/repo"] url = [email protected]:username/repo.git.gitmodules
[submodule "path/to/repo"] path = path/to/repo url = [email protected]:username/repo.gitAre these basically the same things?
解决方案Same answer than .git/info/exclude and .gitignore.
The .gitmodules file can be included in the repository and shared with everyone (that is, it can be added and committed like any regular file), whereas anything in .git (like .git/config) is private (you cannot add it in the repository).
这篇关于.gitmodules和.git / config中指定子模块的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!