I've initiated new local git repository and added some files but there were some files that shouldn't be, so I typed git reset --hard
and then all added files disappeared.
I haven't done any commit on this repository yet.
There is any way to recover my files? I tried to git checkout .
and git checkout <filename>
but both returns error: pathspec '' did not match any file(s) known to git
.
Asked
Active
Viewed 477 times
0
-
look at this it might helps you https://stackoverflow.com/a/1113140/10681908 – Astronaute May 24 '20 at 15:44
-
But I've not done any commit on this repository. – Daniel512 May 24 '20 at 15:47
-
https://stackoverflow.com/search?q=%5Bgit%5D+undo+hard+reset – phd May 24 '20 at 16:15
2 Answers
0
- Since you not commit any file, So you not able to recover that file.
- Solutions is that you recover file from recycle bin / trash. if you delete from bin also. Then use third party tool like EaseUs.

Ashish Sondagar
- 917
- 1
- 9
- 16
-
Does git actually send files to the bin? I thought it just deleted them, no? – wjandrea May 24 '20 at 15:48
0
try this and its work works only if files have not committed and pushed, once i have same problem it worked for me
git checkout your-deleted-file-path

Astronaute
- 219
- 3
- 19