.gitmodules和.git / config中指定子模块的区别? [英] difference between .gitmodules and specifying submodules in .git/config?

查看:117
本文介绍了.gitmodules和.git / config中指定子模块的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能非常愚蠢的问题,但我一直在.gitmodules文件中指定子模块。它最近让我感到可能只是使用.git / config出于同样的原因,所以我不必在工作目录中保留无关文件?

.git / config:

  [submodulepath / to / repo] 
url = git@github.com:username / repo.git

.gitmodules

  [submodulepath / to / repo] 
path = path / to / repo
url = git@github.com:username / repo.git

这些基本上是一样的吗? 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 = git@github.com:username/repo.git

.gitmodules

[submodule "path/to/repo"]
    path = path/to/repo
    url = git@github.com:username/repo.git

Are 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中指定子模块的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆