jeanm
jeanm

Reputation: 1273

.gitignore files deleted but files still ignored (git status doesn't show, can't add)

Well, I'm trying to track all the files I edited in my project, but git status doesn't seem to be working: it doesn't show some files that were changed. I've searched a lot about what could be happening but couldn't go far.

I noticed I have some .gitignore files inside my theme folder /wp-content/themes/mytheme/.gitignore (and subfolders too) and I removed them. Have no idea of how they appeared there. I believe they are ignoring the files I modified.

What I need is to be able to track all modified files to commit, then push to bitbucket. (removing .gitignore files manually didn't solve the problem).

Upvotes: 1

Views: 946

Answers (1)

Mehdi
Mehdi

Reputation: 7403

I'm assuming that by "git status doesn't seem to be working", you mean that modified files do not appear in the command's output.

If this is the case, your problem is probably caused by the fact that the files have been gitignored, and remained in the git's cache as such.

Running these two commands may solve your problem then:

git rm -r --cached .
git add .

Your problem looks similar to this one, but the other way around. Have a look at the top voted solution and its comments.

Make sure that you have a backup of your files before playing around, just in case.

Upvotes: 2

Related Questions