Git 恢复合并到特定的父级
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3240230/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git revert merge to specific parent
提问by NorthIsUp
I have a git repo and am having trouble reverting a merge. The current hash is 0ce2ca0b35f59af267241cf4d40d16a3e13ba6f3. and it has two parents:
我有一个 git repo,但在恢复合并时遇到问题。当前哈希值为 0ce2ca0b35f59af267241cf4d40d16a3e13ba6f3。它有两个父母:
df1acf5f54426d30f12c6b4558c3dd922297aae3
e19b912404ffd3c153ccac3072dbf22396896d2a
doing the following will revert to df1acf5f54426d30f12c6b4558c3dd922297aae3
执行以下操作将恢复为 df1acf5f54426d30f12c6b4558c3dd922297aae3
git revert -m 1 0ce2ca0b35f59af267241cf4d40d16a3e13ba6f3
how do I revert to e19b912404ffd3c153ccac3072dbf22396896d2a?
我如何恢复到 e19b912404ffd3c153ccac3072dbf22396896d2a?
回答by mipadi
git revert -m 2 0ce2ca0b35f59af267241cf4d40d16a3e13ba6f3
Parents are numbered starting with 1; you want the second one.
父母从 1 开始编号;你想要第二个。