0

I rolled back my last push from git using the following commands:

git reset --hard HEAD@{1}
git push -f
git reset --hard HEAD@{1}

The push was successfully deleted but I lost all the changes from file and the rest of the files from visual studio. How can I get those changes back?

Ôrel
  • 7,044
  • 3
  • 27
  • 46
  • 3
    RIP (Rest in pieces). Hint, don't execute commands that you don't fully understand – Trash Can Oct 22 '22 at 03:06
  • 1
    You can probably recover your changes by using `git reflog`. If you search for `git reflog recover deleted commit` you will find lots of links to questions on this site that describe the process. – larsks Oct 22 '22 at 03:14
  • Do you still have the output of the command ? You should have the sha of the commit – Ôrel Oct 22 '22 at 07:37
  • Does this answer your question? [How can I recover a lost commit in Git?](https://stackoverflow.com/questions/10099258/how-can-i-recover-a-lost-commit-in-git) – Orace Oct 22 '22 at 07:42
  • Check the reflog (`git reflog`) to see what the commit ID you are missing is. Then you can use that ID to set a branch or do other things. – eftshift0 Oct 22 '22 at 10:08

0 Answers0