http://stackoverflow.com/questions/953481/restore-a-deleted-file-in-a-git-repo
Find the last commit that affected the given path. As the file isn't in the HEAD commit, this commit must have deleted it.
git rev-list -n 1 HEAD -- <file_path>
Then checkout the version at the commit before.
git checkout <deleting_commit>^ -- <file_path>
replace file_path and deleting_commit with actual values, e.g.
git rev-list -n 1 HEAD -- ./HW6/git checkout 50f50950d846dcb108dc2f19557200b55b4bc7ef^ -- ./HW6/ Another way to check deleted files:git log --diff-filter=D --summary
本文介绍如何使用Git命令恢复已从版本控制系统中删除的文件。通过查找最后一次影响文件路径的提交记录,可以定位到删除该文件的具体提交,并利用Git checkout命令恢复到删除前的状态。
1369

被折叠的 条评论
为什么被折叠?



