git sub module

Posted chucklu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git sub module相关的知识,希望对你有一定的参考价值。

https://github.com/ViRb3/de4dot-cex/blob/master/.gitmodules

 

git submodule sync command - what is it for?

Git stores information about submodules in two places. The first is in a file called .gitmodules, which is checked in to the git repository. Changes to this file are what get propagated to other repositories.

The other location is in .git/config, and it‘s where git actually looks when performing most commands.

 

So imagine you‘ve worked on a project for a while, and there‘s a submodule called foo.

Files for this submodule are checked out from some url, it doesn‘t really matter where.

At some point, however, this url changes.

Perhaps it changes so that the submodule is checked out from a different server, or a different path or whatever.

When you update your repository your copy of the .gitmodules file will be updated, but not your .git/config file; you would still be checking out from the old url.

When you want to start checking out from the new url, you would run git submodule sync to copy the new configuration from .gitmodules to .git/config.

Git doesn‘t do this automatically because you might have made your own changes to your configuration, and it wouldn‘t want to overwrite them.

 

Pull git submodules after cloning project from GitHub

From the root of the repo just run:

git submodule update --init

 

以上是关于git sub module的主要内容,如果未能解决你的问题,请参考以下文章

列出远程git的全部分支

詹金斯管道的 GIT 交叉签出和依赖项检查

git 代码量统计

git代码量统计(转载)

统计代码git提交的行数

Git 统计提交代码行数