在git中合并远程分支

发布于 2024-12-13 08:35:36 字数 629 浏览 5 评论 0原文

我正在开发一个系统,我正在跟踪另一个项目的踪迹,添加我自己的东西,但不直接添加到原始项目中。我使用三个远程分支设置我的存储库:

  1. Master - 我的开发发生的地方。
  2. 供应商 - 我定期与原始项目同步的地方。
  3. 集成 - 我想将(主)和(供应商)合并在一起。

我的工作流程想法是自动进行同步(因为它基本上是一种快进),并且集成是半手动的(因为它需要合并和修复)。我已经涵盖了第一部分(同步),但我无法弄清楚实际发出什么命令来将 Master 和 Vendor 集成到集成中。

这是 gitbranch -a 的输出:

* integration
  master
  vendor
  remotes/origin/HEAD -> origin/master
  remotes/origin/integration
  remotes/origin/master
  remotes/origin/vendor

我如何从这一点前进到:

  1. 将此工作区与远程存储库同步?
  2. 合并供应商和高手融入?
  3. 将集成推回到远程存储库?

显然,如果我在工作流程中出现问题,我很乐意听到。

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.

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:

  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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

揪着可爱 2024-12-20 08:35:36

虽然 integration 分支并不是绝对必要的(您可以通过在顶部重新设置 master 的基础,直接将 vendor 集成到 master供应商),它可能很有用。

将分支 A 集成到分支 B 中可以通过以下方式完成:

  • A 合并到 B 中(但这意味着任何您在 B 中的当前开发处于“搁置”状态,等待解决任何合并冲突,并重新运行所有测试)
  • 之上重新建立 B 基础>A (git rebase A),但这会改变 B 的历史。

我将在 Vendor 之上重新调整 integration 的基础,解决那里的任何冲突,然后将 integration 合并到 master 中,保持掌握历史线性。

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.

Integrating a branch A in a branch B can be done by:

  • 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)
  • rebasing B on top of A (git rebase A), but that would change B's history.

I would rebase integration on top of Vendor, solving any conflict there, and then merge integration in master, keeping master history linear.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文