Today I was going to upload my local project files to Github using shell, but unfortunately deleted the local files after calling "git rebase" command. How can I get the deleted files back?
Asked
Active
Viewed 1,855 times
1 Answers
6
Check git reflog
for a revision history for your repo, something like:
b3f2a61 HEAD@{0}: commit (amend): Adding some more files
ba90657 HEAD@{1}: rebase: Message
3dcbd41 HEAD@{2}: commit: Adding some files
You can resore the repo to a previous state by using the commit ID in the first column like
git reset --hard <ID>
Be careful that this wipes everything that was committed to the repository after the restore point. You may want to back that up separately before doing a hard reset.

Harald Nordgren
- 11,693
- 6
- 41
- 65