As far as I understand, the most common (and recommended) way to handle branching & merging in Subversion is:
- create branch as a copy of trunk
- do disruptive development on branch, and regular development on trunk
- While doing so, regularly merge changes trunk -> branch, to avoid the branch diverging too much. With merge tracking (
svn:mergeinfo
), I can just runsvn merge ^/trunk
, and SVN will automatically fetch all unmerged changes from trunk. - Once the work on the branch is done, merge everything back (on trunk:
svn merge --reintegrate ^/branch/foo
), then discard branch.
(described e.g. in the SVN book, chapter Basic Merging).
Now my problem: While this works well for "feature branches", one sometimes also needs "release branches", which represent shipping/about to ship versions.
With release branches, in my experience merging has to happen in both directions:
- bug fixes from the release branch must be merged into trunk (branch -> trunk)
- but sometimes a bug fix from trunk (or even a new feature) is deemed critical for a release version (or an update to the release), and must therefore be merged trunk -> branch
I have not found anything firm on how SVN and svn:mergeinfo
will handle this. Can I merge in both directions ("bidirectional merge"), and still have svn keep track of merged revisions?
Are there any pitfalls? Anything special to pay attention to?