-2

I deleted some uncommitted class and ı committed all files and pushed. I don't know how can I fix that problem. Please help me. My important classes are lost. I tried some git command but I didn't fix. I used ;

  • git stash
  • git hard
Cem Dırman
  • 61
  • 1
  • 7

1 Answers1

2

Unfortunately, this is not a situation Git can help you with. If the file you deleted had not ever been committed, then by definition Git doesn't know anything about it, and can't help you recover it.

To avoid this situation in the future, I recommend you Commit Early, Commit Often. You can always squash commits together later if you want a cleaner history, but creating WIP commits allows you to roll back easily if you make a mistake.

If you have accidentally deleted a file that had been committed, then you can restore it as described in Find and restore a deleted file in a Git repository.

Scott Weldon
  • 9,673
  • 6
  • 48
  • 67
  • thanks for answer. unfortunately, I lost my files :( – Cem Dırman May 17 '17 at 11:53
  • @CemDırman: Yep, sorry about that. Be sure to [accept my answer](//stackoverflow.com/help/accepted-answer), as this indicates to others that your problem is solved, and also gives you 2 rep! (You can also [upvote](//stackoverflow.com/privileges/vote-up) it if you have enough [reputation](//stackoverflow.com/help/whats-reputation).) – Scott Weldon May 17 '17 at 14:15