So I have been working with Mura CMS a lot lately and I have also migrated all of my projects to Git. But I find myself in a situation that I don't really like. I have an idea of how I might fix it, but I am not expert enough in Mura or Git to know if this is a good idea or if I will find myself in a tough position with it in the future.
Mura is different from any of my other projects because it is more modular (plugins, themes, etc) and because it is someone else's code with my code tucked inside (versus other work I have done with frameworks where it is my code with someone else's tucked inside).
The Core Mura CMS files are something I should not and do not want to edit. So I feel like I should not be bothering to put them into my repo. Instead I feel I should be using the GitHub repo from Blue River. But of course, when I go to deploy Mura, I need my files to be in there somewhere. I need my Site directories with their themes inside and other files I have modified. And I need my plugins in the plugins directory.
I currently keep each of my Mura Plugins in their own Git repos (some on Github and some on BitBucket. I would like to keep it that way. And I plan to put my site folder (minus the cache folder) into a BitBucket repo as well.
So here is what I am thinking:
- Fork the Mura CMS project over to my Github account
- Clone my fork onto my local machine (call it www)
- Update .gitignore to not include the plugins/ folder or my site folders
- Create git submodule in /www/<site folder> where I can then work on my site files in separate version control from the core Mura files
- Create submodules in /www/plugins/<plugin name> for each of my plugins.
As I make changes to each repo I can stage and commit files to their appropriate repos and push to appropriate remotes.
Here is a diagram of what I am thinking:
When new versions of Mura are released I can update my fork. And when I want to grab everything in my project for deployment I can checkout using the --recursive flag when I clone
git clone <path-to-repo> <name-of-folder-to-put-repo-in> --recursive
When you clone recursively git will also clone each of the submodules referenced in the repo. Then I can push the master project (my fork) up to Github, which will only reference the submodules, it will not actually store any of the data there. And then each submodule can be separately pushed to its own remote location and be maintained in its own repo.
So that is what I am thinking. Git seems flexible enough, but I feel like this must have a down-side int here somewhere. Can someone help me find it? Thoughts? Thanks.