问题描述
当我提交我的更改时,我当时并不在任何分支上。
我没有真正注意到这条消息并签出了另一个分支。
I was not currently on any branch when I commited my changes.I didn't really notice the message and checked out another branch.
如何检索我的更改?
我无法合并或签出,因为没有合并分支。
How can I retrieve my changes?I can't merge or checkout, since there is no branch to merge from.
推荐答案
您可以使用 git reflog
来获取你在no branch(一个分离的HEAD)中所做的提交的提交散列,并将它合并到你当前所在的分支(master可能)
You can use git reflog
to get the commit hash of the commit that you did while in "no branch" ( a detached HEAD) and merge that in to the branch that you are currently in ( master maybe)
类似于 git merge HEAD @ {1}
您也可以 git rebase -i
并从引用日志中挑选您想要的提交。
You can also git rebase -i
and "pick" the commit you want from the reflog.
这篇关于目前不在任何分支上+ git commit +在不在任何分支中时签出。我有没有放弃我的改变?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!