title: Include a React app with its own git folder in git repository
body: <p>I have two applications I want to include as part of the same repository. An Express backend and a React frontend. The React frontend was created using <code>npx create-react-app</code>. Creating a React app in this way also creates a <code>.git</code> folder and a <code>.gitignore</code> file in the folder of my React app. After running <code>git init</code> on the parent folder of what I want to include I am left with a repository that contains two <code>.git</code> folders:</p>
  <pre><code>.git
  .gitignore
  README.md
  react-frontend
      .git
      .gitignore
      README.md
  express-backend
  </code></pre>
  <p>After attempting to add files to the repository with <code>git add .</code> git warns me about the second <code>.git</code> folder:</p>
  <pre><code>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; youtube-dl-react-frontend
  hint:
  hint: If you added this path by mistake, you can remove it from the
  hint: index with:
  hint:
  hint:   git rm --cached youtube-dl-react-frontend
  hint:
  hint: See &quot;git help submodule&quot; for more information.
  </code></pre>
  <p>I am not sure what to do here. What is a submodule and is it really what I want to use to include my React app? Or should I just delete the <code>.git</code> folder from the React folder? Or is there something different I should be doing here?</p>
  <p>I also tried commiting, then running <code>git push -u origin master</code> to see if I would be able to push my changes, but I was unable to:</p>
  <pre><code>error: failed to push some refs to 'my project url'
  hint: Updates were rejected because the remote contains work that you do
  hint: not have locally. This is usually caused by another repository pushing
  hint: to the same ref. You may want to first integrate the remote changes
  hint: (e.g., 'git pull ...') before pushing again.
  hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  </code></pre>