简体   繁体   中英

Restore file deleted / commit by mistake

I just wondering if someone know how to see files in a repository.

I pushed an accidentally deleted file to a repository and I don't I'm trying to get the file restored.

You can just git revert the commit in which you deleted the file.

If you've deleted the files on your computer but have not actually commit those changes you can restore locally deleted files:

git ls-files -d | xargs git checkout --

If you deleted that folder from your working copy and you want it back, just do

git checkout <folder_path>

If you accidentally removed the folder from the tracking, committed and pushed such change, then just revert that commit, as suggested by BotskoNet in his answer

git revert <commit_where_this_happened>

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