在 bitbucket 云上使用拉取请求重新构建工作流
Rebase workflow with pull requests on bitbucket cloud
我在 bitbucket cloud 上创建了两个分支,并为这两个分支分别创建了两个拉取请求。拉取请求合并策略设置为 "merge commit"。合并拉取请求后提交树如下所示:
这些是合并策略:
如何在 bitbucket 云上避免这种情况?如果分支可以看到这个或者这是例外情况,那么变基有什么意义?
BitBucket 有其 own merge strategies for pull requests 包括:
Rebase, fast-forward (rebase
+ merge --ff-only
):
Commits from the source branch onto the target branch, creating a new non-merge commit for each incoming commit.
Fast-forwards the target branch with the resulting commits. The PR branch is not modified by this operation.
并且:
Fast-forward only (--ff-only
):
If the source branch is out of date with the target branch, reject the merge request. Otherwise, update the target branch to the latest commit on the source branch.
任何一个都会避免合并提交并产生线性历史记录。
第二个假设 PR 分支在开发人员工作站本地重新定位,然后 push --force
:合并变得微不足道。
OP David asks :
So I need to rebase every second pull request locally, if there are two pull requests created at the same time?
“同时”创建两个 PR 的事实与该过程无关。
其中一个将被合并(没有问题,因为它是第一个被合并的)
第二个不会被合并(被拒绝,因为不是快速合并)
开发人员别无选择,只能:
- pull master 更新它,mast 改变了(这里是第一个合并的 PR)
- 在 master 之上本地 rebase 第二个 PR(在本地解决冲突,确保它仍然有效)
- 强推
- 通过Web GUI合并第二个PR(合并是快进的,会被接受)
涉及本地对帐的过程是通常的最佳做法。
我在 bitbucket cloud 上创建了两个分支,并为这两个分支分别创建了两个拉取请求。拉取请求合并策略设置为 "merge commit"。合并拉取请求后提交树如下所示:
这些是合并策略:
BitBucket 有其 own merge strategies for pull requests 包括:
Rebase, fast-forward (
rebase
+merge --ff-only
):Commits from the source branch onto the target branch, creating a new non-merge commit for each incoming commit.
Fast-forwards the target branch with the resulting commits. The PR branch is not modified by this operation.
并且:
Fast-forward only (
--ff-only
):If the source branch is out of date with the target branch, reject the merge request. Otherwise, update the target branch to the latest commit on the source branch.
任何一个都会避免合并提交并产生线性历史记录。
第二个假设 PR 分支在开发人员工作站本地重新定位,然后 push --force
:合并变得微不足道。
OP David asks
So I need to rebase every second pull request locally, if there are two pull requests created at the same time?
“同时”创建两个 PR 的事实与该过程无关。
其中一个将被合并(没有问题,因为它是第一个被合并的)
第二个不会被合并(被拒绝,因为不是快速合并)
开发人员别无选择,只能:
- pull master 更新它,mast 改变了(这里是第一个合并的 PR)
- 在 master 之上本地 rebase 第二个 PR(在本地解决冲突,确保它仍然有效)
- 强推
- 通过Web GUI合并第二个PR(合并是快进的,会被接受)
涉及本地对帐的过程是通常的最佳做法。