Svn Merge from Trunk to Branch

08 Jan 2008

Every time I need to do this I try to use svn’s –help which is only possible to decipher if you already know what to do. Then I spend too much time on the internet looking for the answer. And finally I break down and ask my tech lead. With much shame. I’m putting this up here so I least I’ll know where to find it. Maybe you too.

In the directory of the branch:

svn merge -r 1001:1002 .

If you checked in some files in revision 1002, then what you’re saying is that you only want the changes from that checkin with ‘-r 1001:1002’ Which is followed by the url of the trunk (where the changes were checked in) and a ‘.’ to say that you want to merge to the current directory. Use ‘–dry-run’ if you want to see what would happen without actually screwing anything up. After the merge is successful, you now have some modified files in the branch you can check in.

Done and done.