1
votes

I'm a bit lost with Subversion (1.5+) here:

I modified the trunk in my local working copy, added new files and directories, etc., but eventually I decided that it would be better to work on a separate branch, so I created one from the base revision of my trunk.

That was the easy part. But what's the best way to move my locally modified files, including added files and directories, to the branch now?

I already tried to switch the trunk like so:

project/trunk $ svn switch svn+ssh://[email protected]/project/branches/mybranch

This worked for some files but then gave me an error message like that when it occurred an added directory:

svn: URL 'svn+ssh://[email protected]/svn/project/branches/mybranch/component/impl/src/main/java/com/xxx/yyy/addeddirectory' doesn't match existing URL 'svn+ssh://[email protected]/project/branches/mybranch/addeddirectory' in 'component/impl/src/main/java/com/xxx/yyy/addeddirectory'

Thanks for any pointers!

1
Note, that this will not catch added directories!Bastl

1 Answers

5
votes

If you haven't committed changes then you could create a patch file from your local copy of files:

svn diff > patch.txt

and then apply that to a new branch

patch -p0 -i patch.txt

More of an explanation here:

http://ariejan.net/2007/07/03/how-to-create-and-apply-a-patch-with-subversion/

If you're using Windows you can do this with TortoiseSVN also...