[英]revert changes to a specific commit
I created a new branch just for myself and now I need to revert multiple commits at once from the master branch to a specific commit. 我为自己创建了一个新分支,现在我需要一次将多个提交从master分支还原到一个特定的提交。 I know there's a safe command to use git revert --no-commit COMMIT_TO_REVERT_FROM..COMMIT_TO_REVERT_TO
我知道有一个安全命令可以使用git revert --no-commit COMMIT_TO_REVERT_FROM..COMMIT_TO_REVERT_TO
this gives me error: empty commit set passed fatal: revert failed
这给了我error: empty commit set passed fatal: revert failed
What should I do ? 我该怎么办 ?
Suggested solutions here on SO were no use. 关于SO的建议解决方案没有用。
Just an example graph to rule out your "empty range" error 只是一个示例图,可以排除“空范围”错误
A---B---C---D---E---F
Let's say your COMMIT_TO_REVERT_FROM
is F
, and COMMIT_TO_REVERT_TO
is C
. 假设您的COMMIT_TO_REVERT_FROM
为F
,而COMMIT_TO_REVERT_TO
为C
git log F..C
should output D
, E
and F
. 应该输出D
, E
和F
I'd recommend triple-checking (in reference to Quentin's comment) these two ends have not been swapped by mistake (which is rather common since the syntax of ranges is counter-intuitive to many). 我建议三重检查(参考Quentin的评论),这两个目标没有被错误交换(这是很常见的,因为range的语法对许多人来说是违反直觉的)。 (Sorry if it's not the case, but it was worth a few minutes to rule it out completely.) (很抱歉,不是这种情况,但是值得完全排除掉几分钟。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.