4

I'm merging my created branch to master. I'm creating new merge request through gitlab website, I get used using GUI than commandline so I thought using gitlab website is ok. After creating the merge request, there's merge conflict.

Then I merge locally using the guide from gitlab website

git fetch origin
git checkout -b otpreflow origin/otpreflow
git fetch origin
git checkout origin/master
git merge --no-ff otpreflow

then I merge the conflicted file, after that

git add .
git commit -m "merge conflict"
git push origin master

and then it says Everything is up to date

shouldn't it pushed to master? I checked in gitlab website, it is not yet merged.

Yes, there are many question with the title git push everything is up to date I already read many of them, I think many of the the problem is different thus I titled my question a bit different, hopes not to confuse the future reader in case this question is solved.

update: running git brach -avv outputs * (HEAD detached from origin/master) 836cf0c6 merge request

otong
  • 1,387
  • 2
  • 17
  • 28

1 Answers1

3

Why you have checkout to origin/master. It is an remote branch which reference remote and is not editable only on update from network connections by git.

It will only update when you fetch data from remote.

So when you checkout to it, it checkout you to a commit id and when you merge new branch into commit, merging happens but master reference on local is not updated, so "Everything is up to date".

Follow this series and it will work:

git fetch origin
git checkout -b otpreflow origin/otpreflow
git fetch origin
#instead of origin/master make it master
git checkout master 
git merge --no-ff otpreflow

Thanks

Paritosh Singh
  • 6,288
  • 5
  • 37
  • 56
  • Hi, do you have the link to docs / reference about immutable branch? First results on google is stackoverflow question and I can't it find in git-scm documentation. Would appreciate it! – otong Dec 20 '18 at 06:17
  • Brances with origin/BRANCH_NAME are remote branch and are not editable by user. Please refer: https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches – Paritosh Singh Dec 20 '18 at 08:44
  • @ParitoshSingh We checkout to origin/master because GitLab tells us to do so. If you edit a merge request they show exact these instructions with checkout origin/master as otong shows. I can't understand why they suggest to do so, if it doesn't work... – fishbone Dec 21 '18 at 15:05
  • @fishbone Can you please send me link to edit merge request or commands which gitlab suggest for same? – Paritosh Singh Dec 26 '18 at 05:09
  • @ParitoshSingh I cannot send a link because it shows these instructions in our client's private GitLab web UI for which I cannot give you access. But I can give you a screenshot: https://imgur.com/a/XTmH2h6 – fishbone Jan 14 '19 at 10:17
  • @fishbone as per my understanding gitlab assumes that checking out to origin master checkouts a local copy of same, which is not the case after git 1.6 (https://stackoverflow.com/questions/1783405/how-do-i-check-out-a-remote-git-branch/1787014#1787014). – Paritosh Singh Feb 04 '19 at 04:58