使用受保护的分支在本地解决合并请求
Resolving a merge request locally with a protected branch
我正在使用 Gitlab,我的合并请求有冲突,我无法使用在线工具解决。我签出目标分支并解决冲突,然后...然后呢?
- 分支是受保护的,所以任何人都不能在上面推送。
- Gitlab 上没有可用的选项来做这样的事情。
在这些情况下应该怎样做才是正确的"way"?我们是否应该创建另一个分支来解决冲突,然后再创建另一个合并请求?或者是否有命令行/我在搜索解决方案时没有看到的替代方案,例如 "push the result of the solving conflict which is not a commit per se" ?
Are we supposed to create another branch to solve the conflict, then
another merge request ?
是,我建议这样做。
1) 从目标分支创建一个新分支
2) 在其中合并你的功能分支
3)解决冲突,添加冲突,提交合并
4) 将新分支推送到远程
5)从新分支到目标one
创建新PR
The branch is protected, so no one is allowed to push on it.
我假设你的意思是目标分支受到保护,我的回答就是基于此。
为了避免 Gitlab 中的合并冲突,我通常选择以下两个选项之一:
- 目标分支上的rebase开发分支,解决rebase过程中的冲突并强制更新分支:
git checkout <development branch>
git rebase <target branch>
# optionally interactive rebase, if I have many commit I like to squash then to avoid solving the same conflicts over and over
# git rebase -i <target branch>
git push -f
- 将目标分支合并到本地开发分支并解决冲突,将其推送到gitlab,那么您的MR上应该不会有任何合并冲突。
我正在使用 Gitlab,我的合并请求有冲突,我无法使用在线工具解决。我签出目标分支并解决冲突,然后...然后呢?
- 分支是受保护的,所以任何人都不能在上面推送。
- Gitlab 上没有可用的选项来做这样的事情。
在这些情况下应该怎样做才是正确的"way"?我们是否应该创建另一个分支来解决冲突,然后再创建另一个合并请求?或者是否有命令行/我在搜索解决方案时没有看到的替代方案,例如 "push the result of the solving conflict which is not a commit per se" ?
Are we supposed to create another branch to solve the conflict, then another merge request ?
是,我建议这样做。
1) 从目标分支创建一个新分支
2) 在其中合并你的功能分支
3)解决冲突,添加冲突,提交合并
4) 将新分支推送到远程
5)从新分支到目标one
The branch is protected, so no one is allowed to push on it.
我假设你的意思是目标分支受到保护,我的回答就是基于此。
为了避免 Gitlab 中的合并冲突,我通常选择以下两个选项之一:
- 目标分支上的rebase开发分支,解决rebase过程中的冲突并强制更新分支:
git checkout <development branch>
git rebase <target branch>
# optionally interactive rebase, if I have many commit I like to squash then to avoid solving the same conflicts over and over
# git rebase -i <target branch>
git push -f
- 将目标分支合并到本地开发分支并解决冲突,将其推送到gitlab,那么您的MR上应该不会有任何合并冲突。