Tortoise Svn Merge Trunk To Branch

It is generally considered good practise with Subversion to keep trunk for stable useable code, and create a development branch from trunk for new development. The new development may be used, for example, to code a new feature, to perform release stabilization, or to experiment with refactoring, and will be merged back into the main branch when the work is complete.

Working on the msp432logger project, I wanted to refactor the code to create a distinct logging application, separate from the driver level, and created a new branch for the work called TRY-loggerapp.

I’m following Subversion best practices for my project directory structure, using trunk, tags and branches sub-directories.

Right-click on the local repository workspace folder in Windows Explorer and pick TortoiseSVN -> Branch/tag… from the Context menu. Select the path for the branch, a log message, and the base for the branch. You can select HEAD or a specific version to base the branch on. If there are no edited files in the working copy, the Copy dialog will default to using the most recent version as the base for the branch.

If you are creating the branch in hindsight and have already made file edits, TortoiseSVN will warn you that basing the branch on HEAD will result in loss of those edits.

In this case, you will likely want your edits (and any new files) to become the first commit in the new branch. In this case, close the warning and select Create copy in the repository from: Working copy.

I selected Switch working copy to new branch/tag in the Copy dialogue when I created the branch. The current branch in the working copy can be verified using the svn info cli command.

If I hadn’t checked Create copy in the repository from: Working copy when I created the branch, I would have had to Switch to the branch in a separate step.

Right-click on the local repository workspace folder in Windows Explorer and pick TortoiseSVN -> Switch… from the Context menu, and select the path for the branch to switch to.

You can confirm your working copy has switched to the desired branch using the Subversion cli command “svn info” as previously described before continuing development in the new branch.

Checking in code is as before, but first check the Commit to: line at the top of the Commit dialogue to confirm the code will be checked into the correct branch.

Eventually you want to merge the development branch back into trunk. The preferred method is to start with a clean working copy, check out the branch to merge into (i.e. check out trunk), then use the TortoiseSVN Merge Wizard to merge the desired branch into trunk.

Test the modified working copy as needed, then commit the modified trunk branch back to the project.

Merge Branch with Trunk
  1. Switch working copy by right clicking project root in Windows Explorer > TortoiseSVN > switch.
  2. Switch to the trunk then ok.
  3. Right click project root in Windows Explorer > TortoiseSVN > merge.
  4. Choose ‘Reintegrate a branch’
  5. In ‘From URL’ choose your branch then next.

5 Answers 5 Sorted by:

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending. 264

I couldnt properly follow the other answers, heres more of a dummies guide…

You can do this either way round to go trunk -> branch or branch -> trunk. I always first do trunk -> branch fix any conflicts there and then merge branch -> trunk.

While developing, you should always try and keep the branch up-to-date with the trunk. In order to do so, select you branch and press merge.Then merge a range of revisions and select the range that is not yet in your repository. I havent done research, but you can probably also use all revisions instead.

When a bugfix has to be done and it has to be in the release branch, fix the issue in the release branch and not in the trunk. Doing so makes sure that there is no unwanted code that comes from the trunk into the branch. Then, merge your changes into the trunk by picking the revision you want to commit. Make sure to commit the change with the commit message provided automatically via the recent messages button. It will include the old message and the TOOLS number as well.

To merge changes from trunk to branch using TortoiseSVN, right-click on the branch and select TortoiseSVN -> Merge… This will display the a dialog with the following options: 1. Merge a range of revisions 2. Reintegrate a branch 3. Merge two different trees Select “Merge a range of revisions”. Click on Next and we will be prompted with another dialog. In the “URL to merge from” text box, enter the URL of the trunk. Click on Next, then Merge on the next dialog. Changes will be merged with your working copy of the branch. You still have to commit these changes.


How do I merge SVN trunk to branch?

Merging in either direction (trunk to branch or branch to trunk) involves these basic steps:
  1. Get a clean working copy of the files into which you will merge changes.
  2. Find the point of divergence.
  3. Have SVN merge changes into a working copy.
  4. Edit any changes SVN could not merge automatically.
  5. Test your working copy.

How do I merge from one branch to another in SVN?

Here’s a basic step-by-step overview of SVN branching and merging.
  1. Create a branch using the svn copy command.
  2. Use svn checkout to check out a new working copy.
  3. Use a sync merge to keep your branch up-to-date as you work.
  4. Use svn merge to send your changes back to the trunk.

How do I merge tortoise branches?

1 Answer
  1. Checkout Master.
  2. TortoiseGit->Merge.
  3. Select branch you want to merge, hit ok.

How do I branch a tortoise in SVN?

To create a branch with TortoiseSVN, select the folder in your working copy which you want to copy to a branch or tag, then right-click and select the command TortoiseSVN → Branch/Tag….

Related Posts