本文介绍了如何恢复已删除的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何恢复我意外从我的 git 存储库中删除的文件?我知道这是一个微不足道的问题,但我还没有在文档中找到答案。

git checkout< commit> < path>



提交可以由SHA1直接指定,也可以通过分支或标记指定。确保在删除的文件仍然存在时表示存储库的状态。如果省略commit参数,将使用当前签出的提交(HEAD)。


How do I restore a file I accidentally removed from my git repository? I know this is a trivial question, but I haven't found the answer in the documentation.

解决方案

git checkout <commit> <path>

Commits may be specified directly by SHA1, or via a branch or tag. Make sure that the represents the state of the repository when the deleted file was still present. If the commit argument is omitted, the currently checked out commit (HEAD) will be used.

这篇关于如何恢复已删除的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 07:49
查看更多