files in the git repo are both deleted and untracked but they're still there. How is that possible?
Asked Answered
V

3

1

All the (hundreds of) files in my repo now show up as untracked and deleted though I can't figure out what's going on?

ls shows the files are in the directory

ls shows the files are there

but git status . in the directory has the files as deleted and untracked. I haven't touched any of these files in a couple months. Also the website the files are for is not working now...

enter image description here

Vie answered 10/3, 2016 at 6:18 Comment(2)
It says "Changes to be committed". That means the deletion of those files has not been committed yet.Iconostasis
Spaces in the filenames?Narthex
B
1

The situation may have been caused by the IDE that you are working with. The possible scenario, AFAIK may have been this :

1- You have deleted the four files ( dashicons.eot, .svg, .... ), from your IDE, which probably has a git plugin to track the changed files.

2- After some time, you changed those file and added them again, but either the IDE git plugin hasn't synced yet or you have restored them from outside of the IDE.

To see what a final valid result for git tracking in these files would be, I recommend :

git reset <file-name>

to unstage changes to be committed for <file-name> or just simply

git reset

which will unstage all file that were staged with git add, either in the terminal or by the IDE plugin.

Then,

git status

I assume you should now see that your files (dashicons) are modified, not deleted

Now you can add them again and commit your modifications and no deletion will be applied to your repository, both local and remote.

Bosun answered 10/3, 2016 at 7:11 Comment(0)
A
1

This same issue happened for me on Mac. Why it happens I have no idea, but after a git pull, git push and git reset HEAD on this branch, it worked fine again.

Arsine answered 24/10, 2019 at 12:49 Comment(1)
For me git reset HEAD was enough. very bizarreMalathion
G
0

The git status shows that you have not committed the changes after deleting the files(dashicons.eot, dashicons.svg, dashicons.ttf and dashicons.woff). Also, it shows these files are untracked.

-

"I haven't touched any of these files in a couple months."

Since you are not sure about the changes you did, we recommend you to clone the project again in another directory and work with the new directory.

Girondist answered 10/3, 2016 at 7:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.