从主分支部署特定功能 [英] Deploy specific features from the master branch

查看:147
本文介绍了从主分支部署特定功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我们使用两个分支来开发:分段 master 。在迭代期间,所有团队成员所做的所有更改都会定期合并到分段分支中,并显示在我们的分段环境中。客户有能力审查变更并提供反馈。在迭代结束时,我们将分段分支合并到主机中,并从主机部署到我们的生产实例



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



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

解决方案

您基本上有2个选项。


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



    $ git revert< merge_commit_sha1>



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




  2. $ 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.

  1. 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)

  2. 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

这篇关于从主分支部署特定功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆