My team uses a publicly available github hosted project as a submodule in our main project. We would like to manage our own patches against that project, without pushing upstream, but then we can't share those patches unless we have a mirror where we push our private branch.
Assuming we have the mirror, our submodule needs two remotes: one where we fetch upstream changes from, and one where we push merges with our patch branch. How can we store the information about the remotes with the submodule (or with the superproject), so that, every member of the team can trivially perform an upstream update, without having to git add remote upstream ...github...project.git
.
We intend to solve the problem by writing a shell script to automate the process and a file for storing the upstream remotes, but is there a git way of doing this?
May be related, but I don't see a proper solution: git add remote in submodule
Git submodules may look powerful or cool upfront, but for all the reasons above it is a bad idea to share code using submodules, especially when the code changes frequently. It will be much worse when you have more and more developers working on the same repos.
Use the git submodule update command to set the submodules to the commit specified by the main repository. This means that if you pull in new changes into the submodules, you need to create a new commit in your main repository in order to track the updates of the nested submodules.
The current ansatz is this:
submodule/.gitupstream
file store the urlThen manually:
I'd like to see a better, possibly git built-in solution though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With