简体   繁体   中英

Can I get back deleted files after using git rebase?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM