git submodule

Cite: https://git-scm.com/book/en/v2/Git-Tools-Submodules#Starting-with-Submodules

MainProject 只追踪 git submodulecommit, 不追踪其内容.

Adding an existing Git repository as a submodule of the repository
that we’re working on

$ git submodule add j.ru@bl:~/git-server/data.git
$ gcam "add data.git module"

Cloning a Project with Submodules

$ git clone j.ru@bl:~/git-server/MainProject
$ cd MainProject
$ git submodule init
$ git submodule update

# There is another way to do this. If you pass `--recursive` to the
# `git clone` command, it will  automatically initialize and update 
# each submodule in the repository.
$ git clone --recursive j.ru@bl:~/git-server/MainProject

在 submodule 中更新 submodule 内容

$ gf
$ gmom
# 或者
$ gl
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 使用场景 基于公司的项目会越来越多,常常需要提取一个公共的类库提供给多个项目使用,但是这个library怎么和gi...
    0xSen阅读 18,729评论 1 26
  • 实例代码:父项目:https://github.com/jjz/pod-project子项目:https://gi...
    0xSen阅读 8,504评论 0 11
  • 写在前面: 1、使用Git Submodule可能遇到的坑(http://blog.devtang.com/201...
    Funnyer阅读 11,190评论 0 0
  • 目的 分开管理 如果是添加公共的库到当前项目中,比起直接复制代码,submodule能追踪上游的更新 添加subm...
    老虎爱吃母鸡阅读 10,977评论 0 4
  • 是什么? submodule子模块,简单来讲就是Git仓库中的子仓库。 想一想是不是遇到过这样的情况,有一个模块是...
    长仙人阅读 11,395评论 0 7

友情链接更多精彩内容