What I'm trying to do is have a master repo with root dir named 'lib', within this are 2 sub-directories 'js' and 'html'. When creating local/dev branches based on 'lib', I need to pull the master 'html' directory, but inside that directory I need the latest 'js' directory.
Fyi, 'html' contains several templates for various projects, 'js' contains our own Javascript libraries but also 3rd party: jquery, YUI, Cufon, etc. Ideally I want to pull from 3rd party repo's where possible, though I can live without that for the time being.
In my case, 'js' should be separate from 'html' because it is used by other projects that have nothing to do with the 'html' directory, but projects based on templates from 'html' always require 'js'.
So my questions:
- Am I able to nest 'js' within 'html' for dev/local branches?
I read about submodules in this SO question, and sparse checkouts, but I didn't understand how either of these could achieve the above - unless I'd clone '/lib' and sparse checkout '/lib/html/template1/' for example, and then inside '/lib/html/template1/js/' clone the same repo and sparse checkout '/lib/js'. In which case my second question:
- If I nest sparse checked out repo's, what will happen when I a) commit at the higher level ('/lib/html/template1/'), and also when I commit at the nested level ('/lib/html/template1/js/')? That sounds a bit dodgy to me.
When work is complete on local branch(es), we'd merge with the dev branch. When the project is complete, we'd merge dev with master. So the third question:
- Will a proposed solution allow the above directory structures and the described workflow?
Diagram outlining the proposed workflow:
I'm more than happy to be told I have the concept skewed, but if so please help me by explaining why, and how I might achieve the above. I'm absolutely no Git pro, I'm trying to start working with Git.