undefined
undefined

Reputation: 3622

Merge my feature branch to master after merge conflicts in VS Code (gitlab)

I am trying to merge my feature branch to master as due to merge conflicts I cant merge it from Gitlab UI.

I followed the steps listed in gitlab command line help:

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

This shows this message which I don't understand:

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'

Then I ran this command to merge to master:

> git merge --no-ff VICE-291

It shows some errors to fail to resolve conflict automatically.

So I resolved it manually and committed the change.

But when I do git branch it shows me this list:

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

I am not sure what is this and how actually I can merge my-feature-branch into master now. Any help is appreciated.

Upvotes: 0

Views: 1740

Answers (1)

Romain Valeri
Romain Valeri

Reputation: 21908

About the message you don't understand : no big worries, a detached HEAD state just means that no branch is currently checked out. It happened after you checked out the commit origin/master points to, since remote-tracking branches can't be checked-out.

Reattach HEAD to your local master and merge your feature branch in :

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

Upvotes: 2

Related Questions