keep changes to git submodules in parent repository

时间:2016-02-12 21:18:53

标签: git git-submodules

I have a project repository that has many third-party repositories as submodules. In order for everything to build I have to make minor changes to some of those submodules. I would like to save these changes as part of the main repositories history (i.e., I can't push those changes to the third-party server and I don't want to have to fork the submodules on my server just for these minor changes). Is this possible?

1 个答案:

答案 0 :(得分:2)

I would like to save these changes as part of the main repositories history (i.e., I can't push those changes to the third-party server and I don't want to have to fork the submodules on my server just for these minor changes).

You need to store the changes somewhere. Your options are:

(a) keep the changes local to whatever system you're working on. This seems unlikely to be useful, if you ever plan on using the parent project anywhere else.

(b) maintain your own forks of these projects with your own patch series, and checkout your submodules from these forks rather than the main upstream repositories. This doesn't require much in the way of effort, since there are a variety of sources for free git hosting.

(c) get your changes accepted upstream so that you don't need to carry local patches.

(d) incorporate the third party projects directly into your project, rather than including them as submodules. Then you can simply save your changes as part of the parent project.

Which of these options is most appropriate depends on your particular situation.