Nicolas400
Nicolas400

Reputation: 653

Merging changes from a branch into the trunk

I'm using SVN for version control, with a project in Eclipse. But, I'm using TortoiseSVN as a client, in Windows 10.

So I commit and update, from Windows Explorer, no problem with that.

So I started a test.

I have a folder /trunk in the repository, and a folder /branches/1.77 also in the repository. (which I created with Tortoise SVN->Branch/Tags) with no problem, I didn't switch.)

First I point my working copy to the trunk folder, create a file versionado.trunk.txt and commit that change.

Everything is OK at this point.

I switch to /braches/1.77. In my working copy I see that SVN deleted versionado.trunk.txt.

Then in my working copy I create another file versionado.branch.txt, and commit. All good, I have versioned versionado.branch.txt.

In my working copy I don't have versionado.trunk.txt, because I working on the branch.

When I switch to the trunk again, versionado.branch.txt is deleted from my working copy, because I'm working in the trunk, and SVN created versionado.trunk.txt again.

My question is where do I have to "be" in the working copy to merge from the branch (x.xx) to the trunk?

My strategy is to work (daily development) in trunk, and I have deployed versions in the branches, where eventually I have to fix some bugs, bugs that I should merge to the trunk!

I try to merge from branches to the trunk (with my working copy pointing to trunk), but SVN tells me that there is a tree conflict, because versionado.trunk.txt not exist (it was deleted on the switch from branches to trunk).

Any idea what I'm doing wrong?

Upvotes: 0

Views: 2218

Answers (1)

Graham
Graham

Reputation: 3883

I'm no SVN expert, but perhaps the following will help:

When you merge changes from a branch into the trunk, you normally aren't directly editing the repository. Instead, you are modifying a working copy of the trunk and then commiting the changes. Merging using the merge command is useful because SVN has this nice SVN property called svn:mergeinfo that preserves the previous history from the merged items. So the following workflow should work:

  1. switch to your trunk's working copy, and make sure it is updated.
  2. merge the revisions from the branch into the trunk's working copy.
  3. commit the changes from the branch into the trunk.

I'm not sure about the tree conflict, because you have not described your directory structure in enough detail, and I am still learning SVN. If you made a new question with a MCVE example of the branch and trunk structures, I'm sure you could get more help.


For going further, I find the section "Keeping a Branch in Sync" in the free book Version Control with Subversion helpful in explaining the basic branch workflow you desire. Although it describes the command line client instead of the Tortoise SVN one, the concepts are the same.

Tortoise SVN's doc also provides a section "Merging" on the topic, though they recommend you go back and read the entire chapter on branching and merging from the SVN book, which I agree with if you want to continue growing in skill with SVN; it's extremely enlightening on SVN's processes even if you don't use the command line client.

Upvotes: 1

Related Questions