I did git reset HEAD -- "*user*"
(to remove all "user" files from the staged area) but now git somehow thinks that I wanted to deleted a completely different file that I didn't even touch lately (the file is also still in my folder). git status
now shows me:
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
deleted: webpack.config.js
I don't want to delete this file. So I want to remove the deletion from the stage and also from the index.
I tried all of the following commands which I found here on StackOverflow but none of these worked... (I of course checked git status
after each command but the deletion was still there):
git restore --staged webpack.config.js
git restore webpack.config.js
git reset HEAD webpack.config.js
git reset -- webpack.config.js
git checkout HEAD -- webpack.config.js
git checkout HEAD webpack.config.js
git checkout -- webpack.config.js
git add webpack.config.js
git rm --cached webpack.config.js
At one point I also tried git checkout .
which deleted all of my unstaged changes... (I was able to bring the changes back by issuing a undo
command for each file in my IDE).
I also tried to unstage the deletion with SourceTree:
But this is also not working.
So what's the right way to remove a file from the staged area (but keeping the changes)?