DEV Community

Lemuel Okoli
Lemuel Okoli

Posted on

3 2

Git ignoring a directory like it doesn't exist?

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! 🍻

Top comments (0)

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay