Reputation: 16515
today I encounter a strange git thing: I have setup a Project A, in Directory A. I copied another Repository B into that and ran a git add --all
, committed and pushed, before I have removed A/B/.git
, because I just forgot it.
So now all changes in A/B
are ignored by git, trying to see some details of that folder within intellij throws Bad Object A/B
error and git fsck
showed something like: dangling blob …
, what is also gone now, after I used those commands:
git reflog expire --expire=now --all
git gc --prune=now
Here is a simplified diagram of the directory layout:
+A
+.git
++B
+.git //added by mistake
How can I fix that?
Upvotes: 0
Views: 65
Reputation: 2738
can you try this
git rm -r --cached .
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
git repack -Ad # kills in-pack garbage
git prune # kills loose garbage
Upvotes: 1