如何从git仓库的历史记录恢复整个目录? [英] How to restore a whole directory from history of git repository?
本文介绍了如何从git仓库的历史记录恢复整个目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
只有1个分支(master)。
我想从git仓库的历史记录中恢复整个目录。
我知道包含错误的提交。
我可以使用父提交的sha1哈希来恢复包含错误之前的目录?
我想过这样的事情:
git checkout 348ce0aa02d3738e55ac9085080028b548e3d8d3 path / to / the / folder /
尝试在修订和路径之间添加' - ':
$ b $
解决方案
git checkout 348ce0aa02d3738e55ac9085080028b548e3d8d3 - path / to / the / folder /
I would like to restore a whole directory (recursively) from the history of my git repository.
There is only 1 branch (master).
I know the commit where errors were included.
Can I use the sha1 hash of the parent commit to restore the state of the directory as it was before the errors were included?
I thought about something like this:
git checkout 348ce0aa02d3738e55ac9085080028b548e3d8d3 path/to/the/folder/
but it did not work.
解决方案
try adding '--' between revisions and paths:
git checkout 348ce0aa02d3738e55ac9085080028b548e3d8d3 -- path/to/the/folder/
这篇关于如何从git仓库的历史记录恢复整个目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文