Running git status
I see a number of files marked deleted
:
On branch my-branch
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
deleted: nta/executor/.gitignore
deleted: nta/executor/NTA_EXECUTOR_README.md
deleted: nta/pom.xml
...
though these files still exist in the file system. I tried using the suggested method to unstage these changes, for example
git restore --staged nta/executor/.gitignore
This worked on some of the files, but many others remain listed as deleted
.
A number of other SO questions describe similar problems:
- Git status incorrectly saying files are deleted
- git shows delete in status, but they're not
- Git status reports deleted files which still exist
but the methods described therein have not solved my particular problem. I have tried
git reset <file>
git reset --hard <file> # fatal: Cannot do hard reset with paths.
git reset -- <file>
git checkout -- <file>
with no luck. Any other ideas?
Additionally
If it helps, here's a description of the probably stupid thing I did to get here:
I wanted to stage a number of files called foo
in various directories:
git add */*/foo
This ended up adding many more foo
s than I expected. So I attempted to backtrack:
git restore --staged */*/foo
And suddenly a ton of non-foo
files were listed as deleted
(and now you know the rest of the story)