如何处理独立头脑中的犯下行为 [英] What to do with commit made in a detached head

查看:79
本文介绍了如何处理独立头脑中的犯下行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用git我做了这样的事情

Using git i made somthing like this

git clone
git checkout {a rev number tree rev before} (here i started to be in a detached head state)
//hacking
git commit
//hacking
git commit
(some commit where made on origin/master)
git pull (wich does complete because there was some error due to the fact that i'm no more on master)

因为git对我说,当我处于独立的头部状态时,我仍然可以提交,所以我这样做了。
但现在我想合并我分离的头部分支到我的本地主分支,然后将我的更改推送到origin / master。

Because git said to me that i can still commit when in a detached head state, I did so. But now i want to merge my detached head branch to my local master branch, and then push my changes to origin/master.

所以我的问题是如何我可以合并主分支与我的实际状态(分离的头部)

So my question is how could I merge the master branch with my actual state (detached head)

推荐答案

创建一个分支,然后切换到主分支并合并它:

Create a branch where you are, then switch to master and merge it:

git branch my-temporary-work
git checkout master
git merge my-temporary-work

这篇关于如何处理独立头脑中的犯下行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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