GitLab – 修复合并冲突

huangapple go评论67阅读模式
英文:

GitLab - Fixing merge conflicts

问题

我们有多个分支 masterdevelopmentbranchTaskNumber,我们从 master 分支获取 branchTaskNumber,完成后将其合并到 development 分支。
创建合并请求时,GitLab显示存在合并冲突。

我们决定拉取 branchTaskNumber 分支并解决冲突,但GitLab再次显示合并冲突。

我们尝试使用GitLab的“解决冲突”按钮来解决冲突,但有时没有取得预期的结果。

我查看了合并冲突,它们似乎涉及空格、行和PHP数组键的顺序。

有任何答案吗?

英文:

We have multiple branches master, development & branchTaskNumber, we take the brachTaskNumber from the master branch, and when finish we merge it into the development branch.
When we create merge requests GitLab shows there are merge conflicts.

We decide to pull the branchTaskNumber branch and fix conflicts but GitLab shows again merge conflicts.

We are trying to fix conflicts with GitLab by Resolve conflicts button, but sometimes it didn't achieve the result.

And I take a look at the merge conflicts it's like whitespace, lines, the PHP array keys order.

Any answers?

答案1

得分: 1

我们从主分支获取brachTaskNumber,然后完成后将其合并到开发分支。

首先,在本地(在你的机器上)将该分支重新基于目标分支(develop)进行操作。

git switch brachTaskNumber
git rebase develop

你将解决所有冲突,然后可以创建你的拉取请求(或者如果你有一个现有的拉取请求,可以强制推送,这将自动更新)。

由于所有冲突在本地已经解决,你的拉取请求在GitLab端将不会显示任何冲突。

英文:

> we take the brachTaskNumber from the master branch, and when finish we merge it into the development branch.

First, rebase locally (on your machine) that branch on top of the target branch (develop)

git switch brachTaskNumber 
git rebase develop

You will resolve all conflicts, then you can make your pull request (or force push if you had an existing pull request, which will be updated automatically)

Since all conflicts are resolved locally, your pull request won't show any conflict on GitLab side.

huangapple
  • 本文由 发表于 2023年2月24日 17:23:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/75554745.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定