While working on Master branch, I forgot to create new branch. Made changes to files then inadvertently reverted to the master, loosing all updates.
I didn’t commit the updated files.
How can I retrieve them?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you had not commited, staged, or stashed the changes you made, there is no way you can recover those changes.
EDIT: Recovering lost changes. Adding this on Mark Longair’s suggestion (in the comment). This also includes a couple of SO links from his answer below(*), that I found quite informative.
If you have ever committed some change and have lost that commit (like committing in a detached state), you can find that commit using
reflog. See this SO question*.If you have lost your last staged changes, you can also recover that. See this SO question*. (I have never used or tried it myself).
If you have stashed a change, you can also recover that using
poporapply. (I am not sure if the popped/dropped stashes are also recoverable that were not committed). You may find this Recover dropped stash in git useful.If there are any other methods that anyone can suggest, I’d edit this answer further to add them.