问题:
This question already has an answer here: 这个问题在这里已有答案:
- How do I revert a Git repository to a previous commit? 如何将Git存储库还原为先前的提交? 41 answers 41个答案
I'm not clear on how git revert
works. 我不清楚git revert
是如何工作的。 For example, I want to revert to a commit six commits behind the head, reverting all the changes in the intermediary commits in between. 例如,我想在头部后面恢复提交六次提交,恢复中间提交之间的所有更改。
Say its SHA hash is 56e05fced214c44a37759efa2dfc25a65d8ae98d
. 说它的SHA哈希是56e05fced214c44a37759efa2dfc25a65d8ae98d
。 Then why can't I just do something like: 那我为什么不能做以下事情:
git revert 56e05fced214c44a37759efa2dfc25a65d8ae98d
解决方案:
参考一: https://stackoom.com/question/7wzT/在Git中恢复由SHA哈希提交-重复参考二: https://oldbug.net/q/7wzT/Revert-to-a-commit-by-a-SHA-hash-in-Git-duplicate
来源:oschina
链接:https://my.oschina.net/stackoom/blog/4281294