Consequences of not using --reintegrate with svn m

2020-07-16 04:38发布

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:

  1. Copy from trunk to create a personal branch.
  2. Check out the personal branch.
  3. Changes and commits.
  4. Get a working copy of trunk.
  5. Merge my branch to the working copy of trunk (again, without --reintegrate).
  6. Commit the merge.
  7. Delete my branch.

标签: svn
1条回答
孤傲高冷的网名
2楼-- · 2020-07-16 05:30

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.

查看更多
登录 后发表回答