1

I have followed 1st answer from this question to upload my source code to my repo but my files got deleted. Now there is only a README.md file and .git folder

Can I recover those files?

EDIT: I just realized, I forgot to do git commit -m 'initial commit comment' and only did
git add .

Community
  • 1
  • 1
khajvah
  • 4,889
  • 9
  • 41
  • 63

1 Answers1

1

I just realized, I forgot to do git commit -m 'initial commit comment' and only did git add .

Then the git pull probably re-initialized the working tree to the remote content (hence the README.md)

You can try and recover your files from the index by following "Recover files that were added to the index but then removed by a git reset":

  • make a full backup of your current repo
  • try a git fsck --full --unreachable --no-reflog
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250