Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to make Git repo in a parent folder realize the a Git repo in a subfolder was removed?

Let me explain the mistakes I made that led to this. For school I have downloaded some example projects for a particular coding topic that they wanted us to have. I stored them all in parent a folder where I established a git repo. The intention was to push this parent folder remotely rather than a bunch of these projects. So, I tried to go through all the example projects to remove their .git files (I imagine they were git files that the school had for their own purposes). But I missed one.

Next, I did the command "git add ." in my parent folder and committed, but I missed the warning that I’ve added another git repository inside a current one. I then pushed my parent folder to a remote repository, and I see that this project which I forgot to remove the .git file from is not accessible on the remote. I have since deleted the .git file for this project, but whenever I try recommitting the parent and pushing, nothing happens (it seems like the parent git doesn’t detect a change) and it’s still not accessible on the remote.

Do you know how I can fix this outside of straight up deleting the repos and doing it over from scratch?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try this:

$ git rm --cached inner_repo
$ git add inner_repo

git status should then show inner_repo as deleted and all its contents as new file. Then commit as usual.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading