简体   繁体   中英

Files deleted after rebase with git, how to recover?

I had some files on my project which rebase deleted. I did not commit anything. I lost some important files, how can I recover them?

git reflog works wonders in such situations: simply use git reflog and note few recent commits that were active. Then use git checkout commit_id to checkout to any particular commit. Most likely, you need previous commit (current one is one you have screwed up).

Also, if you rebase was not committed yet, you can abort it with git rebase --abort . If it was committed, you can simply kill last commit with git reset --hard HEAD~ .

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