I am working on a project where we manage external libs/headers and qa with git. Here is what every developers' directory structure looks like:
~/dev/proj
~/dev/ext
~/dev/qa
proj, ext and qa are different git repositories. Under svn, synchronization of these dirs was simple: a single update under ~/dev would update all of them recursively. With git, we need to do 'git pull' separately for each dir. This is not nice; someone will always forget to update (git pull) one of these dirs and his project will be out of sync (e.g. new qa will not pass with old code). I looked into 'git submodules' and it doesn't provide a single point for 'git pull' to update these three separate modules at the same time [Correction: I was wrong here but please read my answer below].
You could argue that we should have put proj, ext and qa under the same git repository but I thought that would have been against the git philosophy of keeping different concepts in different repositories.
Does anyone have a solution (other than writing a script to do git pull on every dir under ~/dev) to this trivial problem?
Thanks,
Altan
With Git, using multiple repositories is the only way to work efficiently. This enables each team to work independently, and do their work faster. You can also make sure that developers only have access to the repositories they need access to (thus making Git more secure.)
It is easy to synchronize code between multiple git repositories, especially, pushing to multiple remotes. This is helpful when you're maintaining mirrors / copies of the same repository. All you need to do is set up multiple push URLs on a remote and then perform git push to that remote as you usually do.
A multi repo can better support granular access control and configuration changes. If you have a large team that collaborates on a complex infrastructure system, multiple source repositories allow you to localize changes and lessen the blast radius of failed infrastructure updates across the system.
My philosophy is this: if I will always need to pull X and Y together, then logically they belong in the same repository. Using submodules only makes sense if there is appropriate isolation - think external vendor libraries where you don't want to have updates brought in willy nilly and you don't want your team able to edit them directly - that makes sense. But still, it adds steps no matter how you slice it. I for one stick to "put it in one repository if it's one project", regardless of how I might theoretically break it up to be more "git-like".
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