2

I am following the gitlab instructions to perform a local merge of a release branch into our develop branch:

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin  
git checkout -b releaseX origin/releaseX

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin  
git checkout origin/develop   
git merge --no-ff releaseX   

Step 4. Push the result of the merge to GitLab

git push origin develop

I had previously pulled the release branch, so I started at step 3 on the develop branch.

git fetch origin - fetched a few changes in develop
git checkout origin/develop - created a detached head
git merge --no-ff releaseX - merged with conflicts

I manually resolved all the conflicts, then resumed with:

git commit - brought up the commit message editor; saved and closed that
git push origin develop

The attempt to push did nothing and replied with:

Everything up-to-date

I'm not sure where to go from here. None of the answers I've found so far seem to apply to this. The closest I've found is this one, but I'm not sure if the scenarios discussed apply here.

I should mention that I'm using git for Windows and git bash for this.

Jack A.
  • 4,245
  • 1
  • 20
  • 34

1 Answers1

4

The key part is:

git checkout origin/develop - created a detached head

If you are operating on a detached head, don't be surprise that pushing a local branch (like git push origin develop) triggers... nothing: develop HEAD has not changed.

Instead, update develop:

git checkout develop
git pull

Then do your merge: git merge --no-ff releaseX: resolve conflicts, add, commit and push.

Is there any way to reattach the head to origin/develop?

Yes: make sure your branch develop references your current (detached) head.
(Double-check that git status is still showing a detached head first)
See git branch -f:

git branch -f develop
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250