gitx如何让我的'Detached HEAD'提交回主 [英] gitx How do I get my 'Detached HEAD' commits back into master

查看:276
本文介绍了gitx如何让我的'Detached HEAD'提交回主的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Git X并且必须在某些东西上大肆渲染。看起来像几天前我创建了一个名为分离HEAD 的分支,并且已经提交给它。我的正常流程是提交 master ,然后将其推送到 origin 。但我无法推送分离的HEAD



我的下一站停止了我。我选择了 git checkout master - 并且我的分离的HEAD 分支消失了。回到我的项目,我过去几天所做的所有更改都已被抹去。



有没有办法让这些变化回来?

$ b $如果 checkout master 是你做的最后一件事情,那么


Using Git X and must have fumbled royally on something. Looks like a few days ago I created a branch called detached HEAD and have been committing to it. My normal process is to commit to master and then push that to origin. But I can't push detached HEAD.

My next stop screwed me. I selected git checkout master - and my detached HEAD branch disappeared. Going back to my project all of my changes in the past few days have been wiped.

Is there anyway I can get those changes back?

解决方案

If checkout master was the last thing you did, then the reflog entry HEAD@{1} will contain your commits (otherwise use git reflog or git log -p to find them). Use git merge HEAD@{1} to fast forward them into master.

EDIT:

As noted in the comments, Git Ready has a great article on this.

git reflog and git reflog --all will give you the commit hashes of the mis-placed commits.

Source: http://gitready.com/intermediate/2009/02/09/reflog-your-safety-net.html

这篇关于gitx如何让我的'Detached HEAD'提交回主的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆