How to use git subtree with existing git sub repo?
<p>I have a <code>parent_repo</code> and a <code>sub_repo</code> within it, like this:</p>

<pre><code>.\parent
.\parent\parent_file.html
.\parent\.gitignore
.\parent\lib\sub_repo
.\parent\lib\sub_repo\sub_file.html
.\parent\lib\sub_repo\.gitignore
</code></pre>

<p>Before I know about <code>subtree</code> or <code>submodule</code>, I use git for both of the repos. But when people see the <code>parent_repo</code>, they cannot see the <code>sub_repo</code> 's code.</p>

<p><a href="https://i.stack.imgur.com/vJOeQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vJOeQ.png" alt="enter image description here"></a></p>

<p>It is suggested that, I should use <code>subtree</code> or <code>submodule</code>. <a href="https://stackoverflow.com/questions/19584255/what-does-a-grey-icon-in-remote-github-mean">What does a grey icon in remote GitHub mean</a></p>

<p>Then What should I do? To make the <code>sub_repo</code> code available in <code>parent_repo</code>?</p>

<hr>

<p>I looked at the docs of submodule and subtree. It seems like subtree is better than submodule. But the tutorial are not very illustrative (<a href="https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844#.aztjizd8g" rel="nofollow noreferrer">https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844#.aztjizd8g</a>). </p>

<p>I run <code>git subtree add —-prefix=lib/sub_repo my-subtree master</code>, and it reports prefix <code>lib/sub_repo</code> already exists.</p>

<p>Is there any simpler example that I can follow?</p>