5

git 的 submdoule,怎样改变父工程对 submodule 的指向?

 2 years ago
source link: https://www.v2ex.com/t/844965
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  程序员

git 的 submdoule,怎样改变父工程对 submodule 的指向?

  amlee · 9 小时 5 分钟前 · 364 次点击

比如工程 A 中有个目录 B ,这个 B 也同时是一个 submodule 。

A,B 这俩都有独立的 repository 。

当我重新 clone A ,并且在 clone 的时候没有加上 --recurse-submodules 参数时,A 中的 B 目录就会是空的

但是执行 git submodule 会看到 B 目录指向 B 仓库的一次提交。

当 B 仓库有新的提交以后,有什么办法能在不克隆 B 仓库的情况下,就把 A 中的 B 目录指向 B 仓库最新的提交

我现在的做法是,在 A 中的 B 目录把代码 pull 下来,然后再回到 A 中重新 git add B, git commit 。但当 B 越来越大的时候,就不想 pull B 的代码,只想在 A 中改变 B 目录对 B 仓库的引用。

求问,能不能做到呀。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK