Git 恢复不工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23301019/
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 Not Working
提问by Peter Foti
So i've got a develop branch with a commit that I want to revert. So I type in git revert <commit-hash>
所以我有一个带有我想恢复的提交的开发分支。所以我输入git revert <commit-hash>
But when it runs it says:
但是当它运行时它说:
$ git revert 165702b305
On branch develop
nothing to commit, working directory clean
This commit has been tracked down as the culprit of a bug and id like to revert it, but for some reason its not working. Could it be corrupted somehow? Other answers and searches have not been able to help.
此提交已被追踪为错误的罪魁祸首,id 想恢复它,但由于某种原因它不起作用。它会以某种方式损坏吗?其他答案和搜索都无济于事。
回答by sudo
Had same issue using:
有同样的问题使用:
git revert --no-commit <commit-id> -n HEAD
Worked for me
对我来说有效
回答by TsviZan
I following git command will be more specific. It will point out that the revert will start at the HEAD pointer (where the branch is at right now) and end with commit 165702b305:
我遵循 git 命令会更具体。它将指出恢复将从 HEAD 指针(分支现在所在的位置)开始,并以提交 165702b305 结束:
git revert 165702b305..HEAD
回答by Deniz Ozger
I had exact the same issue and the syntax below worked for me:
我遇到了完全相同的问题,下面的语法对我有用:
git revert -n master~5..master~2
回答by serup
I had same issue and ended up making my chances manually. I think the issue is because of other commits. I was trying to revert more than once and I was committing during my reverts and then it stopped working
我遇到了同样的问题,最终手动创造了机会。我认为这个问题是因为其他提交。我不止一次地尝试恢复,并且我在恢复期间提交,然后它停止工作
I suggest trying:
我建议尝试:
git revert --no-commit <commit-id> -n HEAD