开发者

Uneasy development life with git submodule

I have tried git submodule. Although it can solve my problem of sharing repository in projects, but using submodule has 2 issues that troubles me:

  1. The submodule fo开发者_如何学Golder need to commit if submodule contents has committed changes.
  2. Branch settings is not propagate into submodules. We have to manually switch branch in submodules if works in branches are across submodule.

These 2 problems introduces errors easily for daily development work. I found git slave may solve my problem.

Is there any side effect of using git slave?

Or is there are good practices to avoid the above issue in git submodule?


The main point to be aware is quite precely described in the "Gitslave is not perfect" section:

Less obviously, there is a very loose relationship between commits in different repositories.
You cannot easily and precisely determine what commit/SHA any other repository was at when a particular commit was made (though you can approximate and assume pretty easily). Only tags provide exact synchronization between different repositories.

And that is bad in term of reproducibility (one main goal of a VCS: being able to reproduce the state of an environment at any point in its history).
You need to add tags (with a certain naming convention) in order to get back some of the tight correspondence you need between a parent repo and its sub-repos (and which is naturally present with submodules, as I explain in the true natrue of submodules).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜