如何创建分支?
如何在SVN中创建分支?
How do I create a branch in SVN?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
如何在SVN中创建分支?
How do I create a branch in SVN?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(10)
假设您想从主干名称创建分支(如“TEST”)
然后使用:
Suppose you want to create a branch from a trunk name (as "TEST")
then use:
通常,您会将其复制到 svn+ssh://host.example.com/repos/project/branches/mybranch,以便您可以在存储库中保留多个分支,但您的语法是有效的。
以下是关于如何设置存储库布局的一些建议。
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.
如果您甚至打算合并您的分支,我强烈建议您查看以下内容:
Svnmerge.py< /a>
我听说 Subversion 1.5 构建了更多的合并跟踪,我对此没有经验。 我的项目运行在 1.4.x 上,svnmerge.py 是我的救星!
If you even plan on merging your branch, I highly suggest you look at this:
Svnmerge.py
I hear Subversion 1.5 builds more of the merge tracking in, I have no experience with that. My project is on 1.4.x and svnmerge.py is a life saver!
例如 {您的 IP 地址/svn/AAAA/Customization/Project1Branch/MyProject1Branch}。
Like {Your IP address/svn/AAAA/Customization/Project1Branch/MyProject1Branch}.
如果您在主干中有一些本地更改,请使用 Rsync 同步更改
If you have some local changes in trunk then use
Rsync
to sync changesSVN 新用户的重要提示; 这可能有助于快速获取正确的 URL。
运行 svn info 来显示有关当前签出分支的有用信息。
该 URL(如果您在根文件夹中运行 svn)应该为您提供需要从中复制的 URL。
另外,要切换到新创建的分支,请使用 svn switch 命令:
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:如果您的存储库可通过 https 获得,您可以使用此命令进行分支...
If you're repo is available via https, you can use this command to branch ...
使用 svn copy 命令创建一个新分支,如下所示:
Create a new branch using the
svn copy
command as follows:Subversion 中的分支是通过非常非常轻且高效的复制工具来实现的。
分支和标记实际上是相同的。 只需使用 svn copy 命令将存储库中的整个文件夹复制到存储库中的其他位置即可。
基本上,这意味着按照惯例复制文件夹意味着什么——无论是备份、标签、分支还是其他。 根据您想要如何思考事物(通常取决于您过去使用过的 SCM 工具),您需要在存储库中设置一个文件夹结构来支持您的风格。
常见的样式是在存储库顶部有一堆文件夹,称为
tags
、branches
、trunk
等 - 允许您将整个trunk
(或子集)复制到tags
和/或branches
文件夹中。 如果您有多个项目,您可能希望在每个项目下复制这种结构:可能需要一段时间才能习惯这一概念 - 但它有效 - 只需确保您(和您的团队)清楚这些约定您将要使用的。 拥有良好的命名约定也是一个好主意 - 告诉您为什么创建分支/标签以及它是否仍然合适 - 考虑归档过时分支的方法。
Branching in Subversion is facilitated by a very very light and efficient copying facility.
Branching and tagging are effectively the same. Just copy a whole folder in the repository to somewhere else in the repository using the
svn copy
command.Basically this means that it is by convention what copying a folder means - whether it be a backup, tag, branch or whatever. Depending upon how you want to think about things (normally depending upon which SCM tool you have used in the past) you need to set up a folder structure within your repository to support your style.
Common styles are to have a bunch of folders at the top of your repository called
tags
,branches
,trunk
, etc. - that allows you to copy your wholetrunk
(or sub-sets) into thetags
and/orbranches
folders. If you have more than one project you might want to replicate this kind of structure under each project:It can take a while to get used to the concept - but it works - just make sure you (and your team) are clear on the conventions that you are going to use. It is also a good idea to have a good naming convention - something that tells you why the branch/tag was made and whether it is still appropriate - consider ways of archiving branches that are obsolete.
以下是在 Windows 计算机中使用 TortoiseSVN 从主干创建分支的步骤。 这显然需要安装TortoiseSVN客户端。
Below are the steps to create a branch from trunk using TortoiseSVN in windows machine. This obviously needs TortoiseSVN client to be installed.