0

I have a master branch which merges to feature branches. It's been several times now that I'm starting to do something in feature branch and then realised that I want part of those changes in master branch. Is there a way to merge part of those changes to master without loosing the other part when merge from master runs?

let's say I make these changes in feature branch:

Line A
Line B
Line C

Now I merge that with cherry-pick to master, but Line B is specific to that feature, so I remove it. But then merge from master to feature branch runs, and feature branch ends up missing Line B.

What would be the proper way to avoid this? Will -n (no commit) save me from this? I don't mind having conflicts when running merge from master to feature, but what would be the right way to get them?

4

2 に答える 2

1

A way to do this is to generate a commit in feature containing

Line A
Line C

and merging/rebasing master onto that commit, and then having Line B exist in your working directory/later commit in feature.

Apologies if the explanation is not very clear.

于 2012-12-12T21:02:41.183 に答える
0

You could change your branching strategy to not merge the changes from master into your feature branch. Make an additional development branch, in which "regular" changes are made (the kind of things youre now doing on master and merging into feature). Then whenever you want changes to move up into master, merge or rebase them interactively into master, only taking along what you want. And to get the dev updates into the feature branch, merge or rebase development into feature, but leave master alone. That way it doesn't matter if you leave out some of feature's changes in master.

于 2012-12-13T08:15:40.887 に答える