I'm new to subversion. Over the last month I had done some changes and merged them to trunk. Everything seemed fine - my changes got propagated as expected. But today I was re-reading about merging and saw this, saying the following when merging your changes back to trunk:
Now, use svn merge with the --reintegrate option to replicate your branch changes back into the trunk.
and a few paragraphs later:
Notice our use of the --reintegrate option this time around. The option is critical for reintegrating changes from a branch back into its original line of development—don't forget it!
I guess I hadn't read things carefully enough the first time around.
So, it seems I made a mistake with my previous merges back to trunk because I hadn't used the --reintegrate option. What are the consequences of this? Is there something I need to fix?
In case it's useful, my work flow had looked like this:
It never should have been committed. You can use svn merge to “undo” the change in your working copy, and then commit the local modification to the repository. All you need to do is to specify a reverse difference.
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.
The complete merge is used for the 'sync' and 'reintegrate' merges in the 'feature branch' pattern described below. It finds all the changes on the source branch that have not already been merged to the target branch, and merges them into the working copy.
Your workflow is fine if your branch is very short-lived.
If it has a longer life, you'll want to regularly merge changes from the trunk into your branch, to avoid being disconnected from the main branch of activity.
In the end, your feature branch will contain every change from the trunk since you created the branch, + the new feature you developed in the branch. At this time, you need to use the reintegrate
option, because it would be wrong to apply the changes of your branch to the trunk: it would reapply changes that are already in the trunk, since they originate from it.
This is well covered in the section of the SVN book about feature branches.
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