title: Git: How to make outer repository and embedded repository work as common/standalone repository?
body: <p>I have a big project(let's say <code>A repo</code>), and it there one child folder which is come from <code>B repo</code>.  I would meet warning like below when I commit from <code>A repo</code></p>
  
  <pre><code>warning: adding embedded git repository: extractor/annotator-server
  hint: You've added another git repository inside your current repository.
  hint: Clones of the outer repository will not contain the contents of
  hint: the embedded repository and will not know how to obtain it.
  hint: If you meant to add a submodule, use:
  hint:
  hint:   git submodule add &lt;url&gt; extractor/annotator-server
  hint:
  hint: If you added this path by mistake, you can remove it from the
  hint: index with:
  hint:
  hint:   git rm --cached extractor/annotator-server
  hint:
  hint: See "git help submodule" for more information.
  </code></pre>
  
  <p>I have seen <code>git-submodule</code> and <code>git-subtree</code>:</p>
  
  <p><a href="https://stackoverflow.com/questions/36236484/maintaining-git-repo-inside-another-git-repo">Maintaining Git repo inside another git repo</a></p>
  
  <p><a href="https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree" rel="noreferrer">https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree</a></p>
  
  <p>But I don't like them , because they need extra config.</p>
  
  <hr>
  
  <p>What I want is , for example:</p>
  
  <p>structure like:</p>
  
  <pre><code>A/
  --- a.py
  
  --- B/
  --- B/b.py
  </code></pre>
  
  <p>When I change <code>B/b.py</code> .</p>
  
  <ol>
  <li><p>If I am on path <code>A/</code> ,  <code>git add</code> can detect <code>B/b.py</code> changed, <code>git push</code> only commit that to A repo.  </p>
  
  <pre><code>git add .   (would add changes under A/  )
  git push   (would push changes under A/  )
  git pull   (would pull changes under A/  )
  git clone XXX:A  (would clone all files under A/ ,    A/B/ is just looks like plain folder with all files, not a repo )
  </code></pre></li>
  <li><p>If I am on path <code>A/B/</code> , <code>git add</code> only add <code>B/b.py</code> changes to B repo,  and <code>git push</code> only commit that to B repo. </p>
  
  <pre><code>git add .   (would add changes under B/ , but not add changes to A repo)
  git push   (would push changes under B/ , but not push changes to A repo)
  git pull   (would clone changes under B/ ,  )
  git clone XXX:B  (would clone all files under B/  )
  </code></pre></li>
  <li><p>Once I want to snyc A and B in another machine, just do</p>
  
  <pre><code>git clone A
  rm -rf A/B/
  git clone B ./B
  git add . &amp;&amp; git commit 'sync with B'
  </code></pre></li>
  </ol>
  
  <p>In another word, A and B act as a standalone repo.</p>
  
  <p>But the truth is , A repo treat B repo as submodule:  </p>
  
  <p>A repo
  <a href="https://github.com/eromoe/test" rel="noreferrer">https://github.com/eromoe/test</a></p>
  
  <p>B repo
  <a href="https://github.com/eromoe/test2" rel="noreferrer">https://github.com/eromoe/test2</a></p>
  
  <hr>
  
  <p>How do I force A repo track all files under <code>A/</code> , and B repo track all files under <code>A/B/</code> ?   I want A and B act as a self-contain repo , without any other config.</p>