Skip to content
loading...

Git ignoring a directory like it doesn't exist?

okolilemuel profile image Lemuel Okoli twitter logo github logo ・1 min read

You 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 you want the files managed in the main repo. You don't care about the history in a/b/c, so you deleted the .git dir in a/b/c

But the problem is that git status is ignoring a/b/c completely. You can't git add it. It's as though you'd put the path into .gitignore (You haven't).

You have no idea what the problem was or how it arose (v. annoying), but here is how You can fix it:

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"

Cheers! 🍻

twitter logo DISCUSS
Discussion
markdown guide
Classic DEV Post from Aug 6 '19

What to put in your portfolio as a beginner web dev

Lemuel Okoli profile image