Force Git submodules to always stay current

前端 未结 4 1172
悲哀的现实
悲哀的现实 2020-12-07 18:40

I love git submodules. Also, I hate git submodules. What I love about them is how it enables to you to cleanly compartmentalize dependencies etc. I get the point of havin

4条回答
  •  粉色の甜心
    2020-12-07 18:57

    UPDATE: As of git 1.8.2, there seems to be a solution. Please see VonC's answer down below. The original answer is left here for the users of git < 1.8.2.


    No, and this is by design. If there were a way to point a submodule to the "current head" of some other repository, then it would be impossible to retrieve a historical version (such as a tagged version) from the main repository. It wouldn't know which version of the submodule to check out.

    Having said that, you may be interested in the git subtree script. This offers a different way of working with submodules that may be more compatible with your workflow. I was just reminded of this by the recent post on HN.

提交回复
热议问题