简体   繁体   中英

Restore deleted files

I had a lot of files in directory public/uploads/. Before commit I typed git rm -- public/uploads/* and then git commit -a -m "upload" and then git push origin master . In previous commit photos are not present. Now I want to restore them back from git to server. How can I do that?

You cannot recover them if they were never added or committed.

Let's say the hash of the commit where you deleted them is abc123. If you want to undo the whole commit, simply do git revert abc123 . If there were other parts of the commit you want to keep, do:

git revert abc123 --no-commit
git reset
git add public/uploads/
git commit

Then the files will be back in the repository.

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