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 npx create-react-app. Creating a React app in this way also creates a .git folder and a .gitignore file in the folder of my React app. After running git init on the parent folder of what I want to include I am left with a repository that contains two .git folders:
.git
.gitignore
README.md
react-frontend
.git
.gitignore
README.md
express-backend
After attempting to add files to the repository with git add . git warns me about the second .git folder:
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 <url> 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 "git help submodule" for more information.
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 .git folder from the React folder? Or is there something different I should be doing here?
I also tried commiting, then running git push -u origin master to see if I would be able to push my changes, but I was unable to:
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.