Pointy
Pointy

Reputation: 413682

"Merge" new file in trunk into a branch

This should be trivial and obvious but I can't find any examples of this. (I'm certain that's because I'm just searching for the wrong words.)

I need to merge a file from the trunk of my repository down into a branch. The file is new in the trunk, and not yet in the branch; therefore, the normal way that I know to do a merge just doesn't work. Thus, I need to get that new file into the branch somehow.

I need to do this selectively with particular files; in other words I don't want to merge down the whole trunk, and I can't even merge a whole changelist.

Thanks for any suggestions.

edit — I realize I can just copy the file from my trunk workspace and svn add it to the branch, but I don't think that's the "right" way to do this.

Upvotes: 6

Views: 9266

Answers (3)

Jim Yang
Jim Yang

Reputation: 1

Find the parent directory that already exists in the target branch. Use --depth to recursively merge directories and files.

For example:

svn merge -c 1234 --depth infinity ^/RING/trunk/exec/parent parent

Where 1234 is the revision number to be merged.

New files could exist in ^/RING/trunk/exec/parent, but are not yet created in the parent directory of the target branch. The above merge command would add the new files in the target branch parent directory.

Upvotes: 0

karim
karim

Reputation: 15589

The following command, ignores any conflicts, overwrites old files and adds new files: Go to TRUNK directory and merge from BRANCH:

svn merge --accept theirs-full

Upvotes: 0

Matt McHenry
Matt McHenry

Reputation: 20909

You can do something like svn cp ^/trunk/file1 ^/branches/mybranch/file1 to copy individual files from the trunk to the branch.

Upvotes: 11

Related Questions