N
N
Nikolai Shvetsov2016-07-12 19:51:11
git
Nikolai Shvetsov, 2016-07-12 19:51:11

How to recover data after git reset --hard?

did a git add. , then I did git commit, an error came out. By my stupidity I did git reset --hard. Is it possible to restore the data somehow?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
E
evnuh, 2016-07-12
@evnuh

Very unlikely, if you just deleted a lot of files, then it's okay, but you changed a bunch of nearby files, which most likely wiped out the previous changes on the hard.
For such cases, I have the entire working folder with repositories also in the dropbox, and some of the .git folder is also made as a separate repository :)

M
martianin, 2016-07-13
@martianin

Try looking in the git reflog. Commits
may still be there even after git reset --hard

K
Konstantin Samsin, 2016-07-12
@psixodyb

specifying the --hard flag makes the reset command dangerous, git actually deleted the data.
I think there are several options:
1) find a computer where there is still data left before the reset and do what you need with this data
2) try to restore the data using software

K
Konstantin Tsvetkov, 2016-07-12
@tsklab

to restore from memory vm?
A snapshot of the state is taken no longer than a minute. Did you do it before data destruction? If yes, roll back.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question