0

So this is the situation. I was working on the server which don't have any backups. I knew there was old git rep which now is deleted. So I tried to upload everything to my new rep:

git init
git remote add origin ...
git push -u origin master

then i got some errors and did this:

git add .
git status

after that I saw all my filed in queue. that was good. then I did something awful...

git reset --hard

now somehow 80% of all files in directory are gone, I dont have any backup and don't know how to roll it back.. I tried these so far:

git reflog
git log -g
git reset --hard HEAD@{1}
git fsck --lost-found (don't even know why, just tried everything)
git rebase ffff3f3400153fba************ (last blob I saw)
git fsck --cache --unreachable $(git for-each-ref --format="%(objectname)")
git reset --hard @{1}

and still nothing. is there any way to roll it back as it was?

Sandra
  • 315
  • 3
  • 16

1 Answers1

1

Added files that are lost by git reset --hard or some other means will be put in the lost in found. In the case where git fsck --lost-found doesn't show the missing files, navigate to /.git/lost-found/other and do a grep (search) for your files.

jbu
  • 15,831
  • 29
  • 82
  • 105
  • im there and see folder `other` and when entering it I just see many files or directories which are named with hashes – Sandra Feb 14 '17 at 01:05
  • @Sandra Try without the leading slash from your repo folder. – Code-Apprentice Feb 14 '17 at 01:05
  • @Sandra yeah the files will be named strangely, but indeed one of these files will have the contents of the file that you are missing. You need to search the contents - not the file names. – jbu Feb 14 '17 at 01:09