-1

I build successfully at my computer and push to the build server. However, the build server fails to build. The build server log is:

HEAD is now at 85262fd8 Merge remote-tracking branch 'origin/myfeature50'
end reset
start pull
From https://mycomp.net/myproj
    f6a17689..72034e9f   S2 -> origin/S2
Auto-merging src/Service.java
CONFLICT (content): Merge conflict in src/Service.java
Automatic merge failed; fix conflicts and then commit the result.
end pull

git log at my computer:

72034e9f Fix bug
f6a17689 Merge remote-tracking branch 'origin/myfeature200' into S2
..
85262fd8 Merge remote-tracking branch 'origin/myfeature50' into S2

The build server seems to keep pulling from remote-tracking branch 'origin/myfeature50' The build server use gitea. How to fix this build server problem?

Update #1 Must I do rebase instead of merge? I do this but the build server still has the same build (Merge conflict) error:

git checkout myfeature50
git merge --no-ff myfeature200
//resolve conflict
git add
git commit
git push 

Update #2

git checkout myfeature50
git rebase myfeature200
//resolve conflict
git add
git commit
git push
albertkao9
  • 125
  • 8
  • I don't understand quite why you're having this problem. What exactly is your build server doing to get this error? If your build server only clones or updates a source tree by pulling from the head of some branch (the same branch every time), then you should never get a merge conflict, as grabbing the head of a branch should by definition not be doing any merging (all merge conflicts will have already been dealt with). – CryptoFool Feb 13 '22 at 20:08

1 Answers1

0

Software on your build server is attempting to automatically merge your changes, but that fails. If your configuration allows it you could merge the changes yourself, or you could rebase your branch with master and push that, making automatic merge work.

I would suggest rebasing your branch with master and pushing those changes to branch.

eis
  • 51,991
  • 13
  • 150
  • 199
  • Must I do rebase instead of merge? I do this but the build server still has the same build (Merge conflict) error: ```git checkout myfeature50``` ```git merge --no-ff myfeature200``` ```//resolve conflict``` ```git add``` ```git commit``` ```git push``` – albertkao9 Feb 13 '22 at 03:15
  • @albertkao9 you need to either yourself merge your branch *to* master or rebase *from* master to your branch. – eis Feb 13 '22 at 08:17
  • Why merge branch to master? master is a release branch which is updated only when a release is needed (twice a year). Anyway, doing "git push origin master" get "remote: Gitea: Not allowed to push to protected branch master". rebase is not used in our organization. Is there another way to fix this build error? – albertkao9 Feb 13 '22 at 15:52
  • @albertkao9 yes, that's why I said "if your configuration allows it". what do you mean it is not used in your organization? I'm talking about local rebase here. – eis Feb 13 '22 at 15:55
  • Do you mean Update #2 ? – albertkao9 Feb 13 '22 at 20:05