How to stick a submodule to a fix a tag?

别说谁变了你拦得住时间么 提交于 2019-12-08 08:36:40

问题


Assume we have two modules super and minor. Module super depends on version v1.0.3 of module minor, whereas v1.0.3 is an annotated tag on minor:

        v1.0.3
super <-------- minor

Module minor is kind of "private", i.e. only a very small group of developers has write access and others only have read access. Module super is public.

Now I would like to model the dependency of module super to module minor utilizing Git submodules. Unfortunately I can't figure out how to fix the dependency to v1.0.3.

In addition, I would also like --- some time in future --- to fix the dependency to another version.

In all cases I would like to have that ... all developers "automatically" retrieve the module minor in the correct version. ... all developers --- but the afore mentioned small group --- are not allowed to modify this dependency (whereas this is a minor issue)

Any ideas?

Cheers, /nm


回答1:


First, submodules reference commits (SHA1), so the simplest way to memorize the right SHA1 is to go in your submodule and simply git checkout v1.0.3, then go back to your parent repo, commit and push that new state: since a tag is associated to a commit, you will push the fact that your submodule is associated with that tag.
The same process can be repeated when you want to adjust the tag of that same submodule.

Regarding the right to modify that submodule, one way to control that is to add an authorization framework on your Git server: gitolite.



来源:https://stackoverflow.com/questions/12813250/how-to-stick-a-submodule-to-a-fix-a-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!