从主分支部署特定功能

编程入门 行业动态 更新时间:2024-10-24 17:25:25
本文介绍了从主分支部署特定功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 假设我们使用两个分支来开发:分段和 master 。在迭代期间,所有团队成员所做的所有更改都会定期合并到分段分支中,并显示在我们的分段环境中。客户有能力审查变更并提供反馈。在迭代结束时,我们将分段分支合并到主机中,并从主机部署到我们的生产实例

想象一下,当我们具有只能在当前迭代中部分实现的特定功能时,情况就会如此。但同时,我们希望我们的客户能够看到(并且希望给出反馈)该功能在我们的分期环境中带来的变化。因此,在分段分支的迭代结束时,我们提交了与应该应该不应合并到 master

有没有办法解决这种情况?

解决方案

您基本上有2个选项。

  • 将您不进行分期分支的合并想要合并成master:

    $ git revert< merge_commit_sha1>

    这将附加一个新的提交,撤消合并提交的更改(文件删除,代码更改等)

  • $ git cherry-pick< start_hash> ^ ..< end_hash>

  • 记住 ^ 否则git不会包含< start_has h> 提交

    Let's say we use two branches for development: staging and master. During the iteration all the changes made by all team members are regularly merged into staging branch and appear on our staging environment. Customer has the ability to review the changes and give a feedback. At the end of the iteration we merge staging branch into master and perform deployment from the master to our production instance

    Imagine the situation when we have specific feature that can only be partially implemented in the current iteration. But at the same time we want our customer to see (and hopefully give a feedback) the changes brought by that feature on our staging env. As a result at the end of the iteration in our staging branch we have commits related to the features that should and should not be merged into master

    Is there a way to solve situations like this?

    解决方案

    You basically have 2 options.

  • Reverse out the merges from the staging branch that you do not want merged into master:

    $ git revert <merge_commit_sha1>

    This will append a new commit that "undoes" the changes from that merge commit (file deletions, code changes, etc)

  • Cherry pick the ranges of commits into master that formulate the features you want pushed

    $ git cherry-pick <start_hash>^..<end_hash>

  • Remember the ^ or else git will not include the <start_hash> commit

    更多推荐

    从主分支部署特定功能

    本文发布于:2023-11-26 18:37:07,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1634719.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:分支   功能

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!