Nightmare scenario: 3 months worth of changes discarded -- any way to restore them? #144519
-
Select Topic AreaHow to restore discarded changes from Github Desktop on Windows 10? BodyHi there, Like the title says, I hit a nightmare scenario today. I am developing a game and my repository had become too large to push my files, and so I had told myself I would update the .gitignore when I was finished with the present stage of work. Today I finished the integration I was working on, and so I went to discard the commits I had made but not pushed as they were too large in file size, because I wanted to do a new commit with the updated .gitignore that should be within the file size limit. To my horror, when I discarded the changes in Github Desktop, Github went and removed every single change I had made over the last 3 months from the project files on my computer. Is there any way to retrieve or restore these changes? They are not in the recycling bin. I am using Windows 10 and Github Desktop. I have not yet turned off the machine, though I did close Visual Studio Code. Any help would obviously be immensely appreciated! Thank you!! |
Beta Was this translation helpful? Give feedback.
1. Check GitHub Desktop's History and Reflog
GitHub Desktop itself doesn't keep backups of discarded changes, but the underlying Git system may have a way to restore them via the reflog (a record of changes in Git). Here's how to try to recover them:
Open Git Bash: You’ll need to use Git Bash for this recovery process.
Check the Reflog: Run the following command in your project directory (where the repository is located):
The reflog keeps a record of all recent changes, even those that are not committed, and should include entries for the changes you discarded. You should look for any recent commits or changes that were discarded.
Restore the Changes: If you find the comm…