Jimmy P
Jimmy P

Reputation: 1892

SVN: Create branch from earlier revision, then apply specific revisions

I have an SVN branch that I would like to branch again. However, I would like this new branch to be a copy of the source branch at a revision before HEAD. I would then like to apply an arbitrary set of revisions to this new branch after it's created.

For example, the HEAD revision on the branch that I want to branch again is 10. I want to copy this branch at revision 5, then apply revisions 7 and 9 to the new branch.

I know I can accomplish the first part with svn copy -r5 source target, but how do I apply revisions 7 and 9 to target?

I'm using the SVN command line client, not Tortoise or any other GUI-based client.

Upvotes: 2

Views: 394

Answers (1)

bahrep
bahrep

Reputation: 30662

Read SVNBook | Advanced Merging.

Cherrypick merge should work in your case. Note that some of the examples specify --change (-c) instead of --revision.

  1. Checkout a clean working copy of the target branch:

    svn checkout TARGET-URL WCPATH

  2. Merge changes introduced by revisions 7 and 9 in SOURCE branch to the working copy.

    svn merge SOURCE-URL -c7,9 WCPATH

  3. Carefully examine the merge results and svn commit the result.

Upvotes: 1

Related Questions