title: Git how to locally nest remote directories?
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>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'.</p>
  
  <p>So my questions:</p>
  
  <ul>
  <li><strong>Am I able to nest 'js' within 'html' for dev/local branches?</strong></li>
  </ul>
  
  <p>I <a href="https://stackoverflow.com/questions/1979167/git-submodule-update/1979194#1979194">read about submodules in this SO question</a>, and <a href="https://stackoverflow.com/questions/2336580/sparse-checkout-in-git-1-7-0">sparse checkouts</a>, 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:</p>
  
  <ul>
  <li><strong>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/')?</strong> That sounds a bit dodgy to me.</li>
  </ul>
  
  <hr>
  
  <p>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:</p>
  
  <ul>
  <li><strong>Will a proposed solution allow the above directory structures and the described workflow?</strong></li>
  </ul>
  
  <p>Diagram outlining the proposed workflow:
  <img src="https://i.stack.imgur.com/9RjhT.jpg" alt="Diagram outlining the proposed workflow"></p>
  
  <hr>
  
  <p>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.</p>