- These list items are microformat entries and are hidden from view.
- https://dltj.org/article/how-to-fix-a-directory-that-git-thinks-is-a-submodule/
- Nuts. I added and committed a directory to my Git repository when the directory itself was another separate Git repository. Now Git thinks it's some sort of submodule, but it doesn't know how to deal with it:$ git submodule updateNo submodule mapping found in .gitmodules for path 'blah'And worse, Git won't let me remove it:$ git rm blaherror: the following submodule (or one of its nested submodules)uses a .git directory: blah(use 'rm -rf' if you really want to remove it including all of its history)So what to do? This:$ git rm --cached blah$ git add blahIn my case I had a situation where there were several Git repositories-inside-a-repository, so I wanted a way to deal with them all:$ for i in `find . -type d -name .git -print | sed 's#/.git##'`; do > echo $i> rm -rf $i/.git> git rm --cached $i> git add $i> done(Be careful not to run this find command at the root of your Git repository, of course, or else you will effectively destroy its usefulness as a git repo. )
- 2016-03-02T21:53:50+00:00
- 2024-07-20T16:35:17+00:00
How to fix a directory that Git thinks is a submodule
Nuts. I added and committed a directory to my Git repository when the directory itself was another separate Git repository. Now Git thinks it's some sort of submodule, but it doesn't know how to deal with it:
And worse, Git won't let me remove it:
So what to do? This:
In my case I had a situation where there were several Git repositories-inside-a-repository, so I wanted a way to deal with them all:
(Be careful not to run this find
command at the root of your Git repository, of course, or else you will effectively destroy its usefulness as a git repo. )