恢复已删除的文件
恢复在特定提交中删除的文件。
- 使用
git checkout <commit>^ -- <file>命令来恢复在特定<commit>中删除的指定<file>。
git checkout <commit>^ -- <file>
# 示例
# "30seconds.txt" 文件在提交 `3050fc0de` 中被删除
git checkout 3050fc0de^ -- "30seconds.txt"
# 恢复了 30seconds.txt 文件
恢复在特定提交中删除的文件。
git checkout <commit>^ -- <file> 命令来恢复在特定 <commit> 中删除的指定 <file>。git checkout <commit>^ -- <file>
# 示例
# "30seconds.txt" 文件在提交 `3050fc0de` 中被删除
git checkout 3050fc0de^ -- "30seconds.txt"
# 恢复了 30seconds.txt 文件