【发布时间】:2020-03-14 05:23:00
【问题描述】:
所以我在做一个项目,一开始我不小心脱离了 Head,但我仍然保持提交等。然后我意识到我与头部分离,所以我尝试执行以下操作以重新连接到头部:
git log -n 1 (I copied the commit)
git checkout master
git branch (long hash I copied)
git merge tmp (here I realize I forgot to name the branch so I typed again:
git branch tmp (long has I copied)
我在这里收到关于重命名(长哈希)如何不明确的警告,并且 Git 通常不会创建以 40 个十六进制字符结尾的引用
git merge tmp
这里 git 说“已经是最新的”
git branch -d tmp
输出:已删除的分支 tmp
完成此操作后,我被带回了我最后一次连接到头部的状态(在我的项目中是这样)。
我搞砸了吗?或者有什么方法可以让我恢复原来的状态?
【问题讨论】:
标签: git github save commit git-commit