Reputation: 152
I'm creating a project that covers frontend, backend, and mobile. I've set up git in the project root so all phases could be committed. However, I bootstrapped the frontend folder with create-react-app, which creates a project structure of its own (including git).
As it happens, when there's a git inside a git, it is interpreted as a subproject. I just wanted to commit them all to the same repository. I, therefore, proceeded to eliminate all git references from the frontend folder to have it only in the root.
I tried every trick I could think of and it still hasn't worked, the files are still tracked separately. Here's a list of commands I tried both in Powershell and Git Bash:
rm -rf .git
rm -rf .git*
find . | grep "\.git/" | xargs rm -rf
del /F /S /Q /A .git
rmdir .git
rm -rf .gitkeep
rd .git /S/Q
FOR /F "tokens=*" %G IN ('DIR /B /AD /S *.git*') DO RMDIR /S /Q "%G"
Any hints of how getting it the hell out of my folder?
Thanks!
Upvotes: 1
Views: 71
Reputation: 1325037
Removing the .git
is a good first step, but what you are missing is the gitlink (special entry in the index of your main repo referencing the SHA1 of the root tree of the subrepo)
You need to add:
git rm subrepoRootFolder # no trailing /
git commit -m "remove subrepo gitlink"
Then you can git add .
, and all files within subrepoRootFolder
will be (finally) added to your main repository. Then commit and push.
Upvotes: 2