Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN merge individual file revisions from a branch into trunk

Tags:

merge

svn

I have a couple of fixes I've done on a branch that I want merged back into the trunk. I do not want to merge the whole branch into the trunk, just the few branch checkins I've done. What's the correct syntax for doing this?

TY, Fred

like image 952
fred basset Avatar asked Oct 06 '10 21:10

fred basset


People also ask

How do I merge two svn revisions?

To merge a range of revisions, use svn merge -r start:end from to where start and end are revision IDs. This will merge all revisions starting at start+1 up to and INCLUDING end . Note: it will NOT include the first revision (ex: -r3:45 will merge 4 through 45).

What is a sync merge in svn?

The complete merge is used for the 'sync' and 'reintegrate' merges in the 'feature branch' pattern described below. It finds all the changes on the source branch that have not already been merged to the target branch, and merges them into the working copy.


2 Answers

I'm not sure exactly what you're asking as the title talks about merging single files but the text of the question talks about single revisions. In the case of merging single revisions you need: (to merge the changes committed in revisions 100, 105, 115)

cd trunk svn merge -c 100 -c 105 -c 115 http://..../branches/mybranch . 

If you want to merge only the part of revision 100 that affects file.cpp:

cd trunk/path/to/file.cpp svn merge -c 100 http://../branches/mybranch/path/to/file.cpp file.cpp 
like image 99
the_mandrill Avatar answered Oct 13 '22 20:10

the_mandrill


You want to merge the whole branch. Starting in svn 1.5, information on what was merged is stored in the repo - in the svn:mergeinfo property. If you merge an individual file svn:mergeinfo will be set deep in the tree. When someone tries to do a merge from the top of the project, svn:mergeinfo won't exist and they'll have to decide to take that changeset. If you really don't want it to get merged you should merge from the top of the project and then only commit the top level directory (svn:mergeinfo will be the only change) and the file you want.

Way more than anyone ever wanted to know about mergeinfo

like image 42
thekbb Avatar answered Oct 13 '22 21:10

thekbb