I'd like to incorporate an existing project (hosted on GitHub) as a part of my project (into a subdirectory) while maintaining the history and the ability to update that project. I've found that there can be about three approaches:
The (1) variant could be the preferable one at GitHub as they can probably share the sources. But logically my project is not a fork of the existing one. Rather the existing one is just a module. Also I'm not sure if moving the existing code into a subdirectory might not make problems. I would probably prefer the (2) variant as there is only one repo. (3) would require working with several repos but logically is the closest to my situation.
I have researched this quite a bit, but I'm not definitely sure. What would you recommend in this situation? Thank you in advance!
If the development lifecycle of the two projects (the one on GitHub, and yours) are different, then the submodule approach is better.
Ie: if you change your project without having systematically to change the other GitHub project, then you should consider the submodule approach.
However, to implement this, you would need a combination of (1) and (3):
It will allow you to refer one specific revision of the GitHub project, while allowing you to update that submodule and make specific push for it (as described in " true nature of submodules ").
But once you have updated the submodule, don't forget to commit your project (which is the "parent project" for the submodule), in order to register the new revision of the submodule you are now referencing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.