Reputation: 771
I am working on a Magento store (SVN repo connected to Git) utilizing the fabulous HTML5 Boilerplate based Magento-Boilerplate theme (GitHub repo) and extending it with my own child theme (private Git Repo). These all exist in a single www folder which happens to be the top level directory for all three projects. I would like to cleanly integrate all of these into their respective repositories, but the only solutions for multiple repositories in a single directory that I have found are submodules (which I love the idea of, but as far as I can tell require each project to be in a subfolder of the main Git repo) and symlinking the files into place (should work, but a bit messy and rather annoying to keep up).
Is there a clean way to get this done? Here is an example of my folder structure. I have denoted in which repo(s) each file/directory resides - M = Magento, B = Boilerplate, P = Private:
/www
|-- app [M]
|-- frontend [M]
|-- base [M]
|-- magento-boilerplate [B]
|-- default [B]
|-- myprivatetheme [P]
|-- skin [M]
|-- frontend [M]
|-- base [M]
|-- magento-boilerplate [B]
|-- default [B]
|-- myprivatetheme [P]
|-- .htaccess [M][B][P]
|-- favicon.ico [M][P]
As you can see, even without the whole .htaccess and favicon.ico being in multiple repositories mess (I would just gitignore or --assume-unchanged them in the Magento and Boilerplate repos and use my private one for them) the top level directory is www due to the way that Magento splits code and themes into separate folders with a common parent of www. Due to that you can even technically say that the app, skin, and various frontend folders exist in multiple repos as well, since they must exist in each repo all the way up to the top level directory for structure.
Is sym-linking these repos in from separate folders my only solution? It's not a huge problem, but I would be really interested to know if Git is flexible enough to deal with my case. It looks like modman may have been created specifically to aid in this symlinking issue.
Upvotes: 3
Views: 1755
Reputation: 2308
There is also multigit.
Multigit allows you to check out multiple git repositories over a common directory and provides simple tools that let you continue to use git as before, without multigit getting in your way.
It is useful for projects which are made of different components that are developed separately, but which need to deploy files in different parts of the directory structure of the project.
This cannot be done using git submodules or git subtrees, which only allow subprojects to deploy files in their own subdirectory. Multigit allows subprojects to deploy files in any directory of the project, similar to a union filesystem, where each repository is a layer.
Some examples where this combination of change management and module management could be useful:
- manage customizations made to a web app in a separate repository.
- putting your home directory under source control.
- package and/or config manager for a Linux distro.
Upvotes: 1
Reputation: 1522
The tool vcsh was made for organizing the files in $HOME in several repos (ssh, zsh, vim, emacs, …) without using symlinks. vcsh uses fake bare git repos for this. It also works together well with mr which was made to easily organize multiple repos (synced pull, push, …).
Although vcsh was intended for $HOME it can be used for any directory.
vcsh's readme file is a great start and should help you (decide) if it's the tool you're looking for. Richard Hartmann, the maintainer of vcsh, talked about it at FOSDEM 2012: info – slides – video
Upvotes: 2
Reputation: 1326842
I confirm there is no easy way to map a Git repo structure to a deployment structure (which is essentially what your folder structure shows: a deployment into a web folder)
"modman" seems to be a valid way to automate, but you need to remember that if you do any change in one of those submodules, you will need to commit them, push them to their respective upstream, and go to the parent git repo, commit again and push.
All that doesn't seem to be taken into account by modman.
The OP Colt McCormack reports studying modgit:
modgit
is an alternative to the excellentmodman
tool.
Directly inspired from it, modgit allows you to deploy Git modules physically in your project (no symlinks).
Additionally, you can define include/exclude filters to deploy only files and folders of your choice.
Upvotes: 3