I have the master branch that has a bunch of features in it that will not be released. I was asked to remove those features from master and create a new branch that that has them in it so we can merge back to master later.
The steps I took were:
- Create a new branch off of master called "NewFeatures"
- Go back to master, delete all offending code (months of commits, hundreds) by hand
- Commit deletes to master
The expectation was that I would keep working on "NewFeatures" and periodically merge master into "NewFeatures" so that when I merge back in, it is seamless.
Now, when I want to keep "NewFeatures" up to date with master, master wants to delete all the code in NewFeatures.
My question is, what would have been the proper way to accomplish with Git "deleting a bunch of features from master and placing them into another branch for later merging"?
UPDATE Thanks for the responses. I've made a diagram that hopefully explains things. The biggest problem is that at the first merge from main to feature (the first xy on the second row), the main branch wants to erase everything that was y because I removed all y's.
- y - x - y - (remove y's) - x - x - (release x)-x - x - xy - xy - xy - (release xy)
\ \ \ /
y - y - y - y - y - xy - y - y - xy - (done)
UPDATE 2 I ended up moving the branch to just after I deleted NewFeature from main (but I had copied out the removed files) and then copied the removed files back in. This way, main can merge into NewFeature without killing things, and NewFeature can merge back into main without problems. I lose some commit log tracking, but it seemed better than cherry-picking files for the next three days.
The below help seemed to be the correct way to do it, but this way seems to be good enough for me (and the discussion led me to the way I finally did it, so thanks guys).
Thanks, Brian