title: How to make an existing directory within a git repository a git submodule
body: <h2>I'm very confused about git-submodules.</h2>
  
  <p>Basically my problem is that I can't make git understand that <code>~/main-project/submodule</code> is a submodule.</p>
  
  <hr>
  
  <p><strong>I have good experience with git submodules:</strong><br>
  in my <a href="https://github.com/Doron-Behar/dotfiles" rel="noreferrer">dotfiles repository</a> I created the .gitmodules file in <code>~/dotfiles-repo</code> and I added there paths and urls. Since then, If I make changes to the files within the submodules and run <code>git status</code>, I'd get something like like: <code>.vim/bundle/auto-complete (new commits) # in red</code></p>
  
  <p>I created the <code>.gitmodules</code> file in <code>~/main-project</code> but:</p>
  
  <ul>
  <li>If I make changes to <code>~/main-project/submodule</code> and even push the changes, I don't get a similar response like <code>&lt;submodule&gt; (new commits) # in red</code> when running <code>git status</code> in <code>~/main-project</code>. <strong>I just get the changes that were made in those directories</strong></li>
  <li><p>When I hit the folders' links at <code>github</code> for these directories it's not directing me to the repositories themselves but I stay in the same repository.</p>
  
  <ol>
  <li>Maybe I'm missing the whole point. What are the main features of submodules?</li>
  <li>Why does git understands the submodules in <a href="https://github.com/Doron-Behar/dotfiles/tree/master/.vim/bundle" rel="noreferrer">the dotfiles repo</a> but not <a href="https://github.com/Doron-Behar/RFID-entry-permissions-sys" rel="noreferrer">in my other repo</a>?</li>
  <li>Is it because I have already told git to add the files inside <code>~/main-project/submodule</code> to the index?</li>
  </ol></li>
  </ul>
  
  <p>I've read <a href="https://stackoverflow.com/questions/1593620/how-to-make-part-of-an-existing-git-repository-a-submodule">this question</a> which led me to <a href="https://stackoverflow.com/questions/920165/howto-extract-a-git-subdirectory-and-make-a-submodule-out-of-it/1307969#1307969">this answer</a> But I'm not sure I need <code>git-subtree</code>. I don't want to do things that might do changes hard to be revert.</p>
  
  <blockquote>
    <p>Edit: <a href="https://stackoverflow.com/questions/17413493/create-a-submodule-repository-from-a-folder-and-keep-its-git-commit-history">This suggested duplicate-solution</a> didn't work either, I recieved an error that <code>Updates were rejected because the remote contains work that you do not have locally</code>. It seems that <a href="https://stackoverflow.com/users/1092815/gableroux">@GabLeRoux</a> practically told me to push <code>&lt;repo-A&gt;</code> to the url of <code>&lt;repo-B&gt;</code>.</p>
  </blockquote>