1

Whenever I'm on Visual Studio Code and I'm creating new folders for new projects, it tells me there are over 5k in changes. I finally figured out why. It turns out my base directory that holds almost everything I do is initialized as a Git repository itself. I don't know how this happened. I certainly don't want to commit my whole hard drive to Github. I don't think there is actually a repository on Github linked to this folder. Is there a way to undo this so my base directory is no longer a repository? And if I do so, would I need to reclone any repositories in any subdirectories that I do want to keep?

apex2022
  • 777
  • 2
  • 8
  • 28

1 Answers1

1

Is there a way to undo this so my base directory is no longer a repository?

You can just remove the .git folder in your base directory.

would I need to reclone any repositories in any subdirectories that I do want to keep?

You shouldn't need to have to reclone any nested .git directories since removing the outermost .git directory from your base directory won't affect any other .git folders in any subdirectories that you do want to keep.

To be safe, you should copy your base directory and then try removing the .git folder - I don't think removing the .git directory from the base directory should cause any problems, but this is a good backup in case something else does go wrong!

If you want to have a git repo where one git repo also has another git repo nested inside, you could check out https://git-scm.com/docs/gitsubmodules and https://git-scm.com/docs/git-submodule - based on the question you asked, this doesn't seem to be the case, but these are good references just in case you do need it now or anytime in the future.

slow-but-steady
  • 961
  • 9
  • 15
  • Awesome! I just edited the answer to include links to documentation about git submodules as well, which are nested git directories within a git directory - not exactly what you were asking about in this question, but slightly related, so I included the links just in case :) – slow-but-steady Apr 25 '21 at 00:34