Git recover uncommitted changes

0 votes
asked Jul 13, 2010 by lakshman-prasad

I had a lot of local changes.

I just accidentally did

git merge another_branch
git reset --hard HEAD^

on a lot of work. :( with the intention I didn't want the merged changes in here.

How do I recover the original state?

No, the local changes were never committed/stashed.

No way?

3 Answers

0 votes
answered Jul 13, 2010 by jamessan

If the changes had never been committed/stashed/staged, then you're out of luck. If they have, then you should be able to git your changes back by looking for them in git reflog.

0 votes
answered Jul 14, 2010 by eric-walker

Although the uncommitted modifications to tracked files will have been lost, I think any untracked files will still be around unless you subsequently deleted them.

0 votes
answered Sep 15, 2017 by nabil-mohammed-nalak

Foy anyone who is facing this problem in ide's, there is a solution. Search For the ide editor history files of your ide. I had a problem with android studio so here i will give you a solution for android studio.

For eg: In android studio you can always see the previous files , by right clicking on project folder->LOcal History->Show History.

You can see the change history of files and you can also open the files and compare it with new files side by side. If you need old code just copy paste it from there.

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...