简体   繁体   English

在git中合并远程分支

[英]Merging remote branches in git

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: 我用三个远程分支设置我的存储库:

  1. Master - Where my development takes place. 大师 - 我的发展在哪里。
  2. Vendor - Where I sync with the original project periodically. 供应商 - 我定期与原始项目同步的地方。
  3. 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. 我已经介绍了第一部分(同步),但我无法弄清楚将Master和Vendor集成到集成中的实际问题。

This is the output of git branch -a : 这是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: 我如何从这一点前进到:

  1. Synchronize this workspace with the remote repository? 将此工作空间与远程存储库同步?
  2. Merge vendor & master into integration? 将供应商和主人合并为一体化?
  3. Push integration back to the remote repository? 将集成推送回远程存储库?

And obviously, if I have something wrong in the workflow I'd love to hear it. 显然,如果我在工作流程中出现问题,我很乐意听到它。

While the integration branch is not strictly necessary (you could integrate directly vendor into master , by rebasing master on top of vendor ), it can be useful. 虽然integration分支并不是绝对必要的(您可以直接将vendor集成到master ,通过在vendor之上重新设置master ),但它可能很有用。

Integrating a branch A in a branch B can be done by: 在分支B集成分支A可以通过以下方式完成:

  • merging A in B (but that means any current development you have in B is "on hold" pending the resolutions of any merge conflict, and the re-runs of all the tests) B合并A (但这意味着您在B任何当前开发都处于“暂停”状态,等待任何合并冲突的解决方案,并重新运行所有测试)
  • rebasing B on top of A ( git rebase A ), but that would change B 's history. Agit rebase A )之上重新定位B ,但这会改变B的历史。

I would rebase integration on top of Vendor , solving any conflict there, and then merge integration in master , keeping master history linear. 我会在Vendor之上重新integration ,解决那里的任何冲突,然后在master合并integration ,保持master历史的线性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM