Reputation: 97
I have a 3rd party library included in my project. It is important that the "subproject" code should be included in the main/parent one, because the objective is when other people makes git pull, they could will download the code with no extra-effort (or minimal).
But I want the possibility to download updates from the library own repo.
Previously, that library was downloaded directly into his directory and updates were managing by commits in the main project.
Now I'm thinking in use git-subtree or git-submodule. Is git-subtree are useful for that purpose. Is git-submodule better?
Upvotes: 1
Views: 665
Reputation: 1909
Git subtree.
Upvotes: 1
Reputation: 36671
Almost always, it's best to use the package manager of whatever language you're using to include third-party code, pinned to a specific version. If you don't have a package manager, pull the code from a specific commit/tag of the third party repo in a build script into a git-ignored subfolder.
But to answer your question specifically, there are a lot of resources out there to compare subtree and submodule. There are pros and cons each way. I could give you links, but I'd just be copying and pasting from my search. I would suggest that for code you're not directly changing as part of your project, a submodule is fine, because you probably don't want the history of the library code in your project.
Upvotes: 1