我们正在开发feature/x. 我们需要时不时地合并此功能master,并合并master回来feature/x以保持同步。该feature/x分支也作为远程分支存在,因此在这里变基不是一个很好的选择。
我们希望master在将来某个时候禁用/隐藏实际功能。事实上,我希望能够创建一个提交 K,master以便通过将其隐藏在 UI 中来禁用正在开发的功能,但保留底层机制。
我也希望它能够工作,以便当我从masterto合并时feature/x,我将获得除 K 之外的所有提交。此外,当我从feature/xto合并时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 oursfrom mastertofeature/x合并不会导致双向合并。因此,每次我从feature/xto合并时,master我都必须再次禁用该功能,然后这个禁用提交将流回feature/x等等。有没有更好的办法?