Is there way to recover unstaged files

356 Views Asked by At

I staged some files, after did many edits then by mistake hit commit button in sublime merge so many of my files did not committed and only some of them were committed, I wanted to revert it but then I did abort revert so my all files lost. Is there any way to recover that?

1

There are 1 best solutions below

0
Dark_Clouds_369 On

You can use : git checkout 5687e59 --filename.txt

It retrieves the old version of the file which is before the commit made to the staging area and working directory. Use git diff -- staged to view the retrieved file with changes.

Here 5687e59 is the Commit id.