0

I've done the following:

  1. added a new empty repo in GitHub,
  2. run git init to initialize my local project,
  3. run git remote add origin to associate the remote.

However, I then ran git pull to pull from the remote, which seems to have removed my project's source code.

How can I recover this lost source code? This project is very important to me...

jub0bs
  • 60,866
  • 25
  • 183
  • 186
zerxon
  • 1
  • 1
  • `git reset --hard` I try this, but it doesn't work – zerxon Dec 27 '14 at 16:53
  • `git status` what is the result after this command? if you have commited data locally, maybe you can see that. By the way, you should commit locally, then push it to github for the first time, other than pull from github. – Eric Dec 27 '14 at 16:57
  • Did you try `git reset - - head`? – alacy Dec 27 '14 at 16:58
  • 1
    This looks like a possible duplicate of http://stackoverflow.com/q/10362425/1256452 - what version of git do you have? – torek Dec 27 '14 at 17:47
  • `git fsck --lost-found` is work.The lost files will be restored in `.git/lost-found/other`, but there is so many files, is there any way to recover the directory structure? All of you guys, I really thank you. – zerxon Dec 28 '14 at 02:20

0 Answers0