简体   繁体   English

NetBeans:Git:切换到其他分支,提交丢失

[英]NetBeans: Git: Switching to different branch, commit lost

I'm using NetBeans 7.4 and local GIT repository. 我正在使用NetBeans 7.4和本地GIT存储库。 When I tried to check in my last changes I've got the message saying that HEAD is detached in repository, do I want to check in. I've chose Yes. 当我尝试检入上一次更改时,我收到一条消息,说HEAD已从存储库中分离出来,我是否要检入。我选择了“是”。 After that, I switched back to my main branch, but I couldn't find my last check in there. 之后,我切换回主分支,但是在那找不到我的最后一个支票。 Anonymous branch that appeared before, disappeared. 以前出现的匿名分支消失了。 I am not able to find my last check in. Is there any way to find it? 我找不到我的上次签到。是否可以找到它?

You can force that last commit back in command line, using git reflog . 您可以使用git reflog在命令行中强制最后一次提交。

You will be able to find the SHA1 of that commit you did before switching back to your main branch, and you can make a branch on top of that SHA1 . 您将能够找到您在切换回主分支之前所做的提交的SHA1,并且可以在该SHA1之上创建一个分支

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

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