Must a feature branch be deleted after it's merged (reintegrated) back to trunk?
I prefer to constantly merge changes back and forth from my feature branch - I believe this keeps the conflicts to a minimum. Yet I understand that once you use the reintegrate merge to trunk, a feature branch should be deleted.
Is it so? Why? What can I do to circumvent this?
Update I'm asking about technical problems that come from the tool, not "methodology concerns". I intend to keep working on the feature branch after the merge.
Update the top answer indeed specifies a rather complex procedure (merge, delete & rebranch). Is there an easy way to accomplish this in TortoiseSVN? Shouldn't there be?
It depends on what you created the branch for in the first place. A branch is usually used for maintaining a released or soon-to-be-released version of software, so in general, no, you would not delete it.
In the svn book it says merge 's --reintegrate is "to merge all of the source URL's changes into the working copy".
edit: This problem appears to have been fixed in SVN 1.8. The section on basic merging from the SVN 1.8 book has been updated to say that it is OK to reuse a feature branch. The answer below is only relevant for older SVN versions.
From the section on basic merging in the svn book:
In Subversion 1.5, once a --reintegrate merge is done from branch to trunk, the branch is no longer usable for further work. It's not able to correctly absorb new trunk changes, nor can it be properly reintegrated to trunk again. For this reason, if you want to keep working on your feature branch, we recommend destroying it and then re-creating it from the trunk:
This is still the case in SVN 1.6 and 1.7.
This excellent article on reflective merges explains why exactly you can't or shouldn't recycle a feature branch. Summary of the most important points:
Deleting the feature branch and rebranching is cheap and avoids this whole issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With