为什么我的分支拉取请求让另一个团队成员提交

Why Do I get another team member commits for my Branch pull request

在 Bitbucker 中,我得到其他人的提交以及我对分支拉取请求的提交。

  1. 从 master 分支创建两个分支。(假设 A 和 B)
  2. 在控制器中Class 两个成员为同一行添加了两个不同的函数。 (我和我的朋友在两个独立的新分支中为控制器 class 添加了单独的新功能)
  3. 两个分支 A 和 B 为 master 分支创建了拉取请求。
  4. 批准分支A合并请求。
  5. 分支 A 合并到 master。
  6. 分支 B 发生冲突。

试图解决分支 B 的冲突

  1. 结帐大师
  2. git拉
  3. 到 B 分店结帐。
  4. git 变基大师
  5. 在 A 分支功能旁边的控制器中添加了新功能。
  6. git 添加
  7. git 提交

得到一个错误##

错误:无法将某些引用推送到,提示:更新被拒绝,因为您当前分支的提示落后了 提示:它的远程对应物。集成远程更改(例如 提示:'git pull ...') 再推之前。

解决

  1. git 拉 --rebase
  2. git 添加
  3. git 提交
  4. git推

然后现在我在我的提交列表中得到其他团队成员的提交作为 "merge pull request" 现在我不能继续合并请求到 master 分支。我从 bitbucket 收到错误消息,

"The merge could not be completed because the repository is configured to require fast-forward merges and the target branch contains commits which are not present in the source branch. To perform this merge, either merge 'master' into 'vp-42', or rebase 'vp-42' onto 'master'"

您应该返回到第 7 步,然后 git push --force

您更改了分支 B 的历史记录,您的本地 B 是新的官方历史记录。您不想将远程 B 集成到本地 B - 您想要覆盖远程 B 分支。