简体   繁体   English

看到旧的存储后如何返回到最新提交

[英]How to go back to latest commit after seeing old stash

I applied a stash and then made several commits. 我应用了一个存储,然后进行了几次提交。 After that, I decided to do a quick look at the stash again. 在那之后,我决定再次快速查看一下藏匿处。 So I typed: 所以我输入:

git stash apply stash@{0}

I just wanted to see and did nothing. 我只是想看,什么也没做。 Now I just want to go back to my latest commit. 现在,我只想回到我的最新提交。 When I do 当我做

git checkout master

It gives error message 它给出错误信息

error: you need to resolve your current index first
test.js: needs merge

So in this condition, how to go back to my latest commit? 因此,在这种情况下,如何返回到我的最新提交? I also want to know how to check old stash the right way. 我也想知道如何以正确的方式检查旧的藏匿处。

Use the following to reverse apply the stash : Retrieve the stash patch and apply in reverse 使用以下命令反向应用存储:检索存储补丁并反向应用

git stash show -p stash@{0} | git apply -R

Or try 或尝试

git reset --merge and see if you can revert from the new state. git reset --merge ,看看是否可以从新状态恢复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM