How do I create a branch in SVN?
Normally you'd copy it to svn+ssh://host.example.com/repos/project/branches/mybranch so that you can keep several branches in the repository, but your syntax is valid.
Here's some advice on how to set up your repository layout.
If you're repo is available via https, you can use this command to branch ...
svn copy https://host.example.com/repos/project/trunk \
https://host.example.com/repos/project/branches/branch-name \
-m "Creating a branch of project"
svn cp /trunk/ /branch/NEW_Branch
If you have some local changes in trunk then use Rsync
to sync changes
rsync -r -v -p --exclude ".svn" /trunk/ /branch/NEW_Branch
Suppose you want to create a branch from a trunk name (as "TEST") then use:
svn cp -m "CREATE BRANCH TEST" $svn_url/trunk $svn_url/branches/TEST
Below are the steps to create a branch from trunk using TortoiseSVN in windows machine. This obviously needs TortoiseSVN client to be installed.
Top tip for new SVN users; this may help a little with getting the correct URLs quickly.
Run svn info
to display useful information about the current checked-out branch.
The URL should (if you run svn in the root folder) give you the URL you need to copy from.
Also to switch to the newly created branch, use the svn switch
command:
svn switch http://my.repo.url/myrepo/branches/newBranchName