How do I manage conflicts with git submodules?

前端 未结 8 1097
死守一世寂寞
死守一世寂寞 2020-11-30 20:29

I have a git superproject that references several submodules and I am trying to lock down a workflow for the rest of the my project members to work within.

For this

8条回答
  •  感情败类
    2020-11-30 20:47

    I have not seen that exact error before. But I have a guess about the trouble you are encountering. It looks like because the master and one.one branches of supery contain different refs for the subby submodule, when you merge changes from master git does not know which ref - v1.0 or v1.1 - should be kept and tracked by the one.one branch of supery.

    If that is the case, then you need to select the ref that you want and commit that change to resolve the conflict. Which is exactly what you are doing with the reset command.

    This is a tricky aspect of tracking different versions of a submodule in different branches of your project. But the submodule ref is just like any other component of your project. If the two different branches continue to track the same respective submodule refs after successive merges, then git should be able to work out the pattern without raising merge conflicts in future merges. On the other hand you if switch submodule refs frequently you may have to put up with a lot of conflict resolving.

提交回复
热议问题