I have a cloned repo. There's a directory, call it a/b/c that used to be its own repo, i.e. there was a/b/c/.git/ etc.
Now I want the files managed in the main repo. I don't care about the history in a/b/c, so I deleted the .git dir in a/b/c
But the problem is that git status
is ignoring a/b/c completely. I can't git add
it. It's as though I'd put the path into .gitignore (I haven't).
Obviously before, it made sense for git to ignore a subdir with a .git dir in it, but now how does it know the difference?
Is there somewhere else that ignore files are listed other than .gitignore and .git/info/excludes? There's nothing in the .git/config file?
I've been asked what git status says. Not much:
/path/to/root/dir $ git status # On branch fred nothing to commit (working directory clean)
And what git add says. Even less (nothing)
/path/to/root/dir $ git add a/b/c
I have no idea what the problem was or how it arose (v. annoying), but here is how I fixed it, in case anyone else gets stuck:
git rm --cached a/b/c git commit -m "removed phantom a/b/c dir" git add a/b/c git commit -m "finally able to add a/b/c"
Interestingly git log a/b/c
only lists the "finally able..." commit. git show HEAD^
(the "removed phantom..." commit says
-Subproject commit c311ccdc91c8be66019aa138d1c4af49a6b7a81c
So it looks like it was treating it specially some how. I'm going to have to read up more on subprojects and/or submodules.
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