自动化 git 集成分支的合并?

发布于 2024-11-14 22:27:06 字数 947 浏览 0 评论 0原文

根据 http://gitster.livejournal.com/42247.html,分支可以是:

  • “主题”分支=包含与单个功能/错误修复/实验/等相关的所有内聚更改
  • “集成”分支=选择/并选择要从中合并更改的主题分支。

我有主题分支 xyz

我有客户 AB > 每个人都想要/支付不同的功能集。

客户A想要xy。这很简单:

git checkout A
git merge x y

瞧!我有我需要的东西。但是我如何自动化/记录哪些主题应该合并到 A 中?这就是我所做的。在我的配置文件中,我有:

[branch "A"]
    remote=.
    merge=refs/heads/x
    merge=refs/heads/y

现在每次我想更新分支 A 时,我只需:

git checkout A
git pull

它会自动知道要拉取哪些分支。

这是一个好主意还是坏主意?

更具体地说,这就是我在 .git/config 中的内容:

[branch "A.test"]
    remote=.
    merge=refs/heads/x
    merge=refs/heads/y

这样分支 A(即生产分支)就不会意外地拉取任何更改。

According to http://gitster.livejournal.com/42247.html, branches can be either:

  • "topic" branch = which contains all cohesive changes related to a single feature/bug-fix/experiment/etc
  • "integration" branch = which picks/and chooses which topic branches to merge changes from.

I have topic branches x, y, and z

I have customers A and B which each want/paid-for a different set of features.

customer A wants x and y. That's easy enough:

git checkout A
git merge x y

and voila! I have what I needed. But how do I automate/record which topics ought to merge into A? This is what I did. In my config file I have:

[branch "A"]
    remote=.
    merge=refs/heads/x
    merge=refs/heads/y

and so now every time I want to update branch A, I simply:

git checkout A
git pull

and it automatically knows which branches to pull.

Is this a good idea and/or bad idea?

More specifically this is what I have in .git/config:

[branch "A.test"]
    remote=.
    merge=refs/heads/x
    merge=refs/heads/y

So that branch A (which is the production branch) never accidentally pulls any changes.

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

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

发布评论

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

评论(1

GRAY°灰色天空 2024-11-21 22:27:06

你可能不想这样做。一旦 x 和 y 合并到 A 中,将来就没有什么可以从它们合并的了。不过,您的工作流程可能需要这样做。查看 git-flow。

You probably don't want to do that. Once x and y are merged into A, you'll have little else to merge from them in the future. Your work flow might need that though. Check out git-flow.

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