在git中合并远程分支
我正在开发一个系统,我正在跟踪另一个项目的踪迹,添加我自己的东西,但不直接添加到原始项目中。我使用三个远程分支设置我的存储库:
- Master - 我的开发发生的地方。
- 供应商 - 我定期与原始项目同步的地方。
- 集成 - 我想将(主)和(供应商)合并在一起。
我的工作流程想法是自动进行同步(因为它基本上是一种快进),并且集成是半手动的(因为它需要合并和修复)。我已经涵盖了第一部分(同步),但我无法弄清楚实际发出什么命令来将 Master 和 Vendor 集成到集成中。
这是 gitbranch -a 的输出:
* integration
master
vendor
remotes/origin/HEAD -> origin/master
remotes/origin/integration
remotes/origin/master
remotes/origin/vendor
我如何从这一点前进到:
- 将此工作区与远程存储库同步?
- 合并供应商和高手融入?
- 将集成推回到远程存储库?
显然,如果我在工作流程中出现问题,我很乐意听到。
I am developing a system where I'm following the trails of another project, adding my own stuff but not directly to the original project. I setup my repository with three remote branches:
- Master - Where my development takes place.
- Vendor - Where I sync with the original project periodically.
- Integration - Where I want to merge (Master) and (Vendor) together.
My workflow idea is for the synchronization to take place automatically (since it's basically a fast-forward of sorts), and the integration to be half-manual (since it requires merges and fixes). I've got the first part (the sync) covered, but I can't figure out what command/s to actually issue to integrate Master and Vendor into integration.
This is the output of git branch -a:
* integration
master
vendor
remotes/origin/HEAD -> origin/master
remotes/origin/integration
remotes/origin/master
remotes/origin/vendor
How do I go forward from this point to:
- Synchronize this workspace with the remote repository?
- Merge vendor & master into integration?
- Push integration back to the remote repository?
And obviously, if I have something wrong in the workflow I'd love to hear it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然
integration
分支并不是绝对必要的(您可以通过在顶部重新设置master
的基础,直接将vendor
集成到master
中供应商
),它可能很有用。将分支
A
集成到分支B
中可以通过以下方式完成:A
合并到B
中(但这意味着任何您在B
中的当前开发处于“搁置”状态,等待解决任何合并冲突,并重新运行所有测试)之上重新建立
(B
基础>Agit rebase A
),但这会改变B
的历史。我将在
Vendor
之上重新调整integration
的基础,解决那里的任何冲突,然后将integration
合并到master
中,保持掌握
历史线性。While the
integration
branch is not strictly necessary (you could integrate directlyvendor
intomaster
, by rebasingmaster
on top ofvendor
), it can be useful.Integrating a branch
A
in a branchB
can be done by:A
inB
(but that means any current development you have inB
is "on hold" pending the resolutions of any merge conflict, and the re-runs of all the tests)B
on top ofA
(git rebase A
), but that would changeB
's history.I would rebase
integration
on top ofVendor
, solving any conflict there, and then mergeintegration
inmaster
, keepingmaster
history linear.