We are developing a feature in feature/x
. We need to merge this feature into master
every now and then and also merge master
back to feature/x
to stay in sync. The feature/x
branch also exists as a remote branch, so rebasing is not a very good option here.
We want to disable/hide the actual feature in master
until some point in future. In fact, I'd like to be able to create a commit K in master
such that it disables the feature being developed by hiding it in the UI but preserves the underlying mechanisms.
I'd also want this to work so that when I merge from master
to feature/x
, I'll get all commits except K. Also, when I merge from feature/x
to master
, the commit K should still apply in master
, keeping the feature hidden.
I've tried
git co master
git commit -am "disable feature x for now"
=> created commit 12345678
git co feature/x
git merge -s ours 12345678
This works except the feature gets re-enabled in master
when I do
git co master
git merge feature/x
So it seems that merging with -s ours
from master
to feature/x
doesn't result to merge working both ways. So each time I merge from feature/x
to master
I'll have to disable the feature again and then this disabling commit will flow back to feature/x
and so on. Is there a better way?