In an effort to debug a problem in a third party library, I copied their source into my own git repo. I reproduced the problem immediately so wanted to commit to record a starting point. When I attempted to commit, none of the files I had copied were showing up in my working tree, so I couldn't stage them.
I tried explicitly staging one of the files in the copied source:
git add README
fatal: Path 'Src/Foo/README' is in submodule 'Src/Foo/FooBar'
So it seems git thinks it's a submodule, even though I never told it that it was. I tried deleting the .git directory in the root of the third party source, but that didn't help. Then I tried following these instructions, but it tells me I have no submodules:
git submodule deinit .
No submodule mapping found in .gitmodules for path 'Src/Foo/FooBar'
Any ideas?
You can't just clone the repo any more, you have to clone recursively. You can't just checkout branches any more, you have to init and update the submodules too, with extra complications if the same submodules don't exist in all branches. You can't just commit/push, you have to commit/push the submodules first.
The simplest solution is to clone that third-party repo, reproduces your fix, commit and push (if you have access to their repo, you if you have forked it on GitHub)
If not, do (in a fresh clone of your repo) a:
git ls-tree HEAD Src/Foo/FooBar
See if there is an special entry 160000
, which would indicate that FooBar was registered as a submodule at one point in time) even if the .gitmodules doesn't list FooBar anymore.
A git rm --cached Src/Foo/FooBar
(with git 1.8.5+) would take care of that submodule entry.
Of course, if the thirdparty sources are not part of a git repo, then adding them in a different folder within your own repo would work too.
But the history of those third-party library files would become mixed with the history of your main repo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With