10

有人在 BitBucket 上向我发送了拉取请求。有问题的更改在默认分支上提交。在将其合并之前,我想进行一些调整,但更重要的是,我想发布此更改的预览版本,以便社区对其进行评估,看看他们是否满意。

理想情况下,我想将更改拉入主仓库,但将其放在分支上。做一些调整。像我对任何其他构建一样标记它,然后发布。但是,这似乎是不可能的:如果我理解正确,分支是“烘焙”的,我无法将更改拉到不同的分支上。这个对吗?

如果是这样,我能做些什么呢?我可以拉动然后将第二个头合并到遗忘中,同时还可以从我拉动的变化中创建一个分支。或者我可以在 fork 上完成这项工作,但这意味着在主 repo 中不会有与此构建相关的标签。或者我应该完全做其他事情吗?

PS 更改本身是高质量的,这不是要求原作者改进它。

4

4 回答 4

3

这可能会有所帮助:

http://www.electricmonk.nl/log/2014/03/31/test-a-pull-merge-request-before-accepting-on-bitbucket/

基本上,该链接说要执行以下操作:

  • git fetch https://bitbucket.org/myrepository/master somename
  • git checkout FETCH_HEAD
  • 检查代码并测试心脏的内容。
  • (如果代码被接受), git checkout master
  • git 合并 FETCH_HEAD
  • git 推送
于 2014-04-07T11:19:20.513 回答
3

而不是使用 Bitbucket 的“接受拉取请求”,只需将更改拉入您的本地存储库。您可以使用 rebase 将提交(或一组提交)移动到命名分支。然后只需将更改推送到您的主要 bitbucket 存储库。(并且可能会拒绝 bibucket 拉取请求,并附上评论说更改已推送到主仓库)

例如:

如果你的回购是:bitbucket/ProjectA/MainRepoForProjectA

pullrequest 来自:bitbucket/someuser/MainRepoForProjectA

  1. 从 bitbucket/someuser/MainRepoMainRepoForProjectA 拉取
  2. rebase 到新拉取的提交到命名分支。
  3. 进行您想要进行的任何额外更改。
  4. 推送到 bitbucket/ProjectA/MainRepoMainRepoForProjectA

注意:如果您之前没有使用过 rebase:

  1. 在 TortoiseHg 文件 -> 设置 -> 扩展中启用它
  2. 更新到您也想移动更改的分支负责人。
  3. 右键单击要移动的更改的基础 -> 修改历史记录 -> 变基
于 2013-03-07T01:48:33.067 回答
2

What accepting a pull request does is described in the docs; it'll try to merge, and you'll get to solve conflicts. The docs do mention you can set the target branch when creating the pull request. But since your branch didn't exist yet, your contributor couldn't pick it.

So you'll have to pull to your local machine and move some commits to a new branch in Hg then push to your bitbucket.

Do read the rebase docs because changing history will have consequences for the validity of your contributors repo, he'll have to fork again to be in sync with you again. This can become cumbersome if he already has some more high quality code ready for you.

于 2013-03-07T18:26:11.657 回答
0

可以将拉取请求的代码拉取为:

git fetch origin refs/pull-requests/$PR_NO/from:$LOCAL_BRANCH
于 2015-11-06T12:33:04.773 回答