如何在返回到先前的提交后返回到unpushed提交

我提交了我的代码,但没有推送它。 让我们称这个提交#5后来我需要尝试更早的版本。 所以我签出提交#3。 现在我想回到我的提交#5。 我如何找到它的提交ID并返回给它?

试过git日志,但它只显示从#3到#1的提交。


你可以使用这个方法让HEAD重新提交#5,只需运行这个命令:

git checkout branch_name

之后,请参阅lvan的评论以运行此命令以查看日志:

git log --oneline --decorate --graph --all

你会发现它会将头移到最新的提交#5

链接地址: http://www.djcxy.com/p/3965.html

上一篇: How to return back to unpushed commits after returning back to an earlier commit

下一篇: How to undo 'git fetch'