1

I initially had merge issues and made an unwise decision to do "git merge --abort" and lost all my files. For which I read wrongly that "git reset --hard HEAD~1" would restore the lost files. Unfortunately, it wiped out most of my files. I then read I could do a "git reflog" to get the specific head before I decided to do the "git reset --hard HEAD~1" I then did a "git reset HEAD@{15}" to the specific head. It shows a list of all the files that were deleted. but When I check the folder, the deleted files are not there. And if I do a "git status". it shows me the list of all the files that were deleted by the git reset. How do make the files become visible on the directory?

Recover from git reset --hard?

I was hoping after the "git reset HEAD@{15}" the files would become available in the directory

Hans Ben
  • 91
  • 10

1 Answers1

0

Solution in you case:

git reset --hard HEAD@{15}

git reset (--mixed) vs git reset --hard

git reset --hard [commit] updates index (staging area) and your working directory

git reset [commit] updates index (staging area) and doesn't change the working directory