VS Code(gitlab)中的合并冲突后,将我的功能分支合并到母版中

时间:2019-03-08 09:56:28

标签: git merge gitlab

由于合并冲突,我无法从Gitlab UI进行合并,因此我尝试将功能分支合并到master。

我按照gitlab命令行帮助中列出的步骤进行操作:

> git clone <my_repo>
> git fetch origin
> git checkout -b my-feature-branch origin/my-feature-branch
> git fetch origin
> git checkout origin/master

这显示了我不理解的消息:

Note: checking out 'origin/master'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:



git checkout -b new-branch-name

HEAD is now at ddf9bbd Merge branch 'some-different-feature-branch' into 'master'

然后我运行此命令以合并到主服务器:

> git merge --no-ff VICE-291

它显示了一些无法自动解决冲突的错误。

所以我手动解决它并提交更改。

但是当我执行git branch时,它将显示以下列表:

* (HEAD detached at origin/master)
  my-feature-branch
  master

我不确定这是什么,现在不确定如何将my-feature-branch合并到master中。任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:2)

关于您不了解的消息:不用担心,分离的HEAD状态仅表示当前未检出任何分支。签出origin/master指向提交后,由于无法签出远程跟踪分支,因此发生了这种情况。

将HEAD重新连接到本地主机,然后合并功能分支:

git checkout master
git merge --no-ff VICE-291