A Git subtree solution for embedding the subproject code
In a slightly more advanced solution, you can use the subtree merge to join the history of a subproject to the history of a superproject. This is only somewhat more complicated than an ordinary pull (at least, after the subproject is imported), but provides a way to automatically merge changes together.
Depending on your requirements, this method might fit well with your needs. It has the following advantages:
- You would always have the correct version of the library, never using the wrong library version by accident.
- The method is simple to explain and understand, using only the standard (and well-known) Git features. As you will see, the most important and most commonly used operations are easy to do and easy to understand, and it is hard to go wrong.
- The repository of your application is always self-contained; therefore, cloning it (with plain old
git clone
) will always include everything that’s needed...