Nick
Nick

Reputation: 961

how merge changes in a feature branch which already has changes from trunk

I see very similar questions asked previously, but can't seem to find one that is the exact answer to mine. Sorry if this is a duplicate.

I am working on a feature branch, committed 10s of revisions, and every now and then I have been merging revisions on trunk into my feature branch. Now the feature is ready and working, and I want to merge my changes back to trunk. In plot, this is

trunk --------------------^
      \     \     \      ?
 feat  v-----v-----v----?

My first thought was to do a straighforward whole branch merge, whereby I merge changes on feat since all the way back when the branch was forked off, until the HEAD. But the trouble I see is that intermediate revisions that were merged from trunk (including several file additions and removals) cause conflicts when merged back to trunk again.

I am wondering whether the whole branch merge is the right way to do this, despite the conflicts? Or, was that simply a bad idea to be doing intermediate merges from the trunk onto the the feat; albeit, that being somewhat necessary?

Thanks!

Upvotes: 3

Views: 119

Answers (2)

mliebelt
mliebelt

Reputation: 15525

The whole technique is named in Subversion "Reintegrate a branch". You should notice that after the reintegration, you should throw away your branch (local copy and the branch in Subversion repository), just to ensure, that it is not used any more. The SVN red book documentation explains in an example which steps to take (the same as @Daemin described).

Upvotes: 0

Dominik Grabiec
Dominik Grabiec

Reputation: 10665

The way that this has been tackled where I've worked previously is that just before the merge back into trunk you do one final rebase. This means that the only changes getting checked into trunk would be the ones that have occured on your branch, and also since you just rebased it should go smoothly.

  • Pull the latest changes from trunk to your branch.
  • Fix conflicts, make the application compile, etc.
  • Merge your branch into trunk.

Upvotes: 2

Related Questions