Reputation: 31
By mistake I got rid of some of my work by clicking "unstage changes" in vs code, after they were already staged. Is there any way to get them back?
Upvotes: 2
Views: 2188
Reputation: 177
I thought this happened when I had 1 file staged and 2 files as unstaged. When I clicked the "unstage change" button I expected to see 3 files in the unstaged changes section but only saw 2. What actually happened was the staged file was the same as one of the unstaged files so the changes merged back into the 2 files. In this case no need to play around with recovering files.
Upvotes: 0
Reputation: 78623
Yes - when you stage changes, the file is added to the object database and a reference to that file is recorded in the index. You can use the git-recover
tool to identify files that were added to the repository (staged) but are no longer referenced, and recover them to the working directory.
Upvotes: 3