如何在SVN中创建分支?


当前回答

Create a new folder outside of your current project. You can give it any name. (Example: You have a checkout for a project named "Customization". And it has many projects, like "Project1", "Project2"....And you want to create a branch of "Project1". So first open the "Customization", right click and create a new folder and give it a name, "Project1Branch"). Right click on "Myproject1"....TortoiseSVN -> Branch/Tag. Choose working copy. Open browser....Just right of parallel on "To URL". Select customization.....right click then Add Folder. and go through the folder which you have created. Here it is "Project1Branch". Now clik the OK button to add. Take checkout of this new banch. Again go to your project which branch you want to create. Right click TorotoiseSVN -> branch/tag. Then select working copy. And you can give the URL as your branch name. like {your IP address/svn/AAAA/Customization/Project1Branch}. And you can set the name in the URL so it will create the folder with this name only. Like {Your IP address/svn/AAAA/Customization/Project1Branch/MyProject1Branch}. Press the OK button. Now you can see the logs in ...your working copy will be stored in your branch. Now you can take a check out...and let you enjoy your work. :)

其他回答

下面是在windows机器中使用TortoiseSVN从主干创建分支的步骤。这显然需要安装TortoiseSVN客户端。

右键单击本地windows计算机上更新的中继 选择TortoiseSVN 点击分支/标记 选择SVN存储库中的To路径。注意,目标URL是根据给定的路径和分支名称更新的 在储存库浏览器中不能在分支中创建文件夹 添加分支路径。例如,分支/ 添加有意义的日志消息供您参考 单击“确定”,这将在本地系统上创建新文件夹 签出创建到新文件夹中的分支

假设您想要从主干名称(如“TEST”)创建一个分支 然后使用:

svn cp -m "CREATE BRANCH TEST" $svn_url/trunk $svn_url/branches/TEST

Create a new folder outside of your current project. You can give it any name. (Example: You have a checkout for a project named "Customization". And it has many projects, like "Project1", "Project2"....And you want to create a branch of "Project1". So first open the "Customization", right click and create a new folder and give it a name, "Project1Branch"). Right click on "Myproject1"....TortoiseSVN -> Branch/Tag. Choose working copy. Open browser....Just right of parallel on "To URL". Select customization.....right click then Add Folder. and go through the folder which you have created. Here it is "Project1Branch". Now clik the OK button to add. Take checkout of this new banch. Again go to your project which branch you want to create. Right click TorotoiseSVN -> branch/tag. Then select working copy. And you can give the URL as your branch name. like {your IP address/svn/AAAA/Customization/Project1Branch}. And you can set the name in the URL so it will create the folder with this name only. Like {Your IP address/svn/AAAA/Customization/Project1Branch/MyProject1Branch}. Press the OK button. Now you can see the logs in ...your working copy will be stored in your branch. Now you can take a check out...and let you enjoy your work. :)

SVN新用户的小贴士;这可能有助于快速获得正确的url。

执行svn info命令显示当前签出分支的有用信息。

URL应该(如果您在根文件夹中运行svn)提供您需要从中复制的URL。

也可以使用svn switch命令切换到新创建的分支:

svn switch http://my.repo.url/myrepo/branches/newBranchName

使用svn copy命令新建分支,如下所示:

$ svn copy svn+ssh://host.example.com/repos/project/trunk \
           svn+ssh://host.example.com/repos/project/branches/NAME_OF_BRANCH \
      -m "Creating a branch of project"