git submodules
Closed this issue · 2 comments
You could use Git submodule. Each commit in the parent reference precise commit in the submodules, it's realy great for dependant projects.
Can you elaborate?
We actually used submodules once, but in the main repo as a mean to import an old version of that repository which then contained compiled versions of our dependencies.
It's true that we could use Git submodules here to reference the external dependencies, but that would mean abandoning the current way of tracking the precise commit, currently located in a yml file in the "client" repository (e.g. thirdparty.yml in Lugdunum).
- first create a subdirectory inside your root project for sub projects (ex: external/) (this step is optional)
- next you clone the subproject(s) with the submodule command:
git add submodule remote-git-path external/subproj
- this will allow you to:
cd
into your subproject,git checkout
and all other git command- go back to root project and
git add external/subproj
to your commit.
subprojects are tracked in the root project as a single entry.
For cloners of the root project, the magic command is:
git submodule update --init --recursive
and each time you move your working root dir to another commit, you should apply this command to update the submodule(s) to the corresponding revision.
When you want to move a subproject to a newer revision, cd into the subproject, fetch,pull, checkout, go up in the root and add the subproject path to your commit.
Try it, it's really easy.