We had a SVN branch recently that had been merged back to trunk, and some more work on that feature/functional area was needed. I suggested using the same branch but was told you shouldn't re-use a branch once it has been integrated into trunk (a reference in SVN docs was given, I can't find it now). That suggests a branch is fairly useless once you merge back to trunk, so my question is once a branch is no longer needed, should it simply be deleted or kept?
For those using TortoiseSVN, you can accomplish this by using the Repository Browser (it's labeled "Repo-browser" in the context menu.) Find the branch folder you want to delete, right-click it, and select "Delete." Enter your commit message, and you're done.
If you merge a branch into trunk using "svn merge --reintegrate", you are recommended to delete the branch. If you want to do further development in that branch, you should "re-branch", effectively create a new branch with the same name, but rooted at the same revision as you merged the branch into trunk.
In the From URL option, you should specify the branch to which you want to merge. For example, assume that there are 2 branches, branch A and branch B , and you want to merge branch B to branch A . In TortoiseSVN, click on Merge option and then select Merge two different trees option.
When I integrate a branch, I move it from branches/
to branches/integrated/
. Keeps branches/
clean so its easy to find current work, but also makes it easy to dig up old branches to see what changes were made without needing to do a lot of revision-number archeology.
SVN 1.5 introduced the "mergeinfo" property, which allow you to easily reintegrate branches to the trunk while supporting repeated branch updates. This allows you to create a branch, perodiocally update the branch from the trunk , and finally reintegrate the branch to the trunk ( svn merge --reintegrate ). This is useful for example when you create a branch to fix a bug or to develop a functionality.
The way mergeinfo is implemented doesn't allow you to do a subsequent reintegration, so this is the reason why you are recommended not to reuse the branch.
This is problematic for "release branches" when you want to develop the bug fixes on the release branch and do periodic reintegration to the trunk.
If you want to reuse a branch, the usual pattern is to create a new copy ( branch ) with the same name:
When you "recreate" the branch, in step 3, the mergeinfo is restored, so you can reintegrate in the future without problems.
Back to your question: "so my question is once a branch is no longer needed, should it simply be deleted or kept?" I would keep the branch, so it would be visible in the HEAD revision. Having branches disappear is confusing ( "hey, did we create a branch for release 0.1 last week? " "hmm, I don't remember... check the repo history" )
As for reusing the branch, I would use the convention to never reuse a branch, and if you need to "add somethig to it", recreate it. But in my opinion it is much clearer to use a different branch name. You probably can use a naming convention to identify the branches. For example, the original would be branches/Issue-1 and subsequent extensions branches/Issue-1.0 , branches/Issue-1.1 , etc
Mergeinfo references.
http://blogs.open.collab.net/svn/2008/07/subversion-merg.html http://blogs.open.collab.net/svn/2009/11/where-did-that-mergeinfo-come-from.html
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