想象一下,当我们具有只能在当前迭代中部分实现的特定功能时,情况就会如此。但同时,我们希望我们的客户能够看到(并且希望给出反馈)该功能在我们的分期环境中带来的变化。因此,在分段分支的迭代结束时,我们提交了与应该应该不应合并到 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
更多推荐
从主分支部署特定功能
发布评论