Visual studio git push failed, lost .sln and cannot recover project

633 Views Asked by At

This is my final assignment for my course. I worked really hard on it, and was supposed to push the files to a git repository. I tried doing so and it failed, I believe I pressed revert afterwards, it did nothing.

When I went to check to my local repository, my usual files were gone, I got two new hidden folders vs. and git. I can find the debugged .exe file which runs okay, but I really need my code back.

Is there any way to retrieve it?

More info: my .cpp files are now .obj files, I can't find the .h files, there are also .exe.recipe files, and some .idb and .pdb files in the folder.

1

There are 1 best solutions below

0
JohnAndom On

I managed to retrieve my original files by using git reflog, followed by git reset —hard Head@{n}, and then git retrieve for each file.

Thanks everyone.