【发布时间】:2013-11-26 14:13:36
【问题描述】:
我们正在feature/x 中开发一项功能。我们需要不时将此功能合并到master,并将master 合并回feature/x 以保持同步。 feature/x 分支也作为远程分支存在,因此这里变基不是一个很好的选择。
我们想禁用/隐藏master 中的实际功能,直到将来某个时候。事实上,我希望能够在master 中创建一个提交 K,以便通过将其隐藏在 UI 中来禁用正在开发的功能,但保留底层机制。
我还希望它能够正常工作,这样当我从 master 合并到 feature/x 时,我将获得除 K 之外的所有提交。此外,当我从 feature/x 合并到 master 时,提交K 仍应适用于 master,保持该功能隐藏。
我试过了
git co master
git commit -am "disable feature x for now"
=> created commit 12345678
git co feature/x
git merge -s ours 12345678
这可行,但当我这样做时,该功能会在 master 中重新启用
git co master
git merge feature/x
因此,似乎将-s ours 从master 合并到feature/x 并不会导致双向合并。所以每次我从feature/x 合并到master 时,我都必须再次禁用该功能,然后这个禁用提交将流回feature/x 等等。有没有更好的办法?
【问题讨论】:
标签: git merge feature-branch