0

I am trying to recover my lost change from a newly created local git repository.

I have no commits in master branch and I did a git reset --hard.

Lost all my staged changes. The files were new and untracked.

Using git fsck --lost-found command I am able to see the files that I lost.

There are 35000 files and I want to get them back with their name and folders structure they were in.

Harry
  • 1
  • 2
  • Possible duplicate of [Undo git reset --hard with uncommitted files in the staging area](https://stackoverflow.com/questions/7374069/undo-git-reset-hard-with-uncommitted-files-in-the-staging-area) – mab Jan 31 '19 at 08:51
  • The names are *gone*. There is no in-Git way to reconstruct them. If there's internal data within the content that you can use to construct the names, write a program to use it. Otherwise it's a manual process over all 35,000 files. – torek Jan 31 '19 at 16:02

1 Answers1

0

git fsck --lost-found did create found objects into .git/lost-found/*/ directory where you may find all of your files contents (but not the directory structure).

mab
  • 378
  • 1
  • 8
  • It did so. too many files to manually find and rename. Looking for the solution to reatain those files by a script or some OOTB git feature. Thanks – Harry Jan 31 '19 at 08:43