如何创建分支?

发布于 2024-07-04 00:59:45 字数 19 浏览 6 评论 0原文

如何在SVN中创建分支?

How do I create a branch in SVN?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

櫻之舞 2024-07-11 00:59:45

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

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

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
骄兵必败 2024-07-11 00:59:45

通常,您会将其复制到 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.

以歌曲疗慰 2024-07-11 00:59:45

如果您甚至打算合并您的分支,我强烈建议您查看以下内容:

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!

掐死时间 2024-07-11 00:59:45
  • 在当前项目之外创建一个新文件夹。 您可以给它任何名称。 (例如:您有一个名为“Customization”的项目的结帐。它有很多项目,例如“Project1”、“Project2”......并且您想创建“Project1”的分支。所以首先打开“自定义”,右键单击并创建一个新文件夹并为其命名“Project1Branch”)。
  • 右键单击“Myproject1”....TortoiseSVN -> 分支/标签。
  • 选择工作副本。
  • 打开浏览器...就在“To URL”的并行右侧。
  • 选择自定义...右键单击然后添加文件夹。 并浏览您创建的文件夹。 这里是“Project1Branch”。 现在单击“确定”按钮进行添加。
  • 结帐这家新银行。
  • 再次转到您要创建哪个分支的项目。 右键单击TorotoiseSVN -> 分支/标签。 然后选择工作副本。 您可以将 URL 作为您的分支名称。 例如 {您的 IP 地址/svn/AAAA/Customization/Project1Branch}。 您可以在 URL 中设置名称,以便仅使用该名称创建文件夹。
    例如 {您的 IP 地址/svn/AAAA/Customization/Project1Branch/MyProject1Branch}。
  • 按确定按钮。 现在您可以看到日志...您的工作副本将存储在您的分支中。
  • 现在您可以签出...并让您享受您的工作。 :)
  • 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. :)
鸠书 2024-07-11 00:59:45
svn cp /trunk/ /branch/NEW_Branch

如果您在主干中有一些本地更改,请使用 Rsync 同步更改

rsync -r -v -p --exclude ".svn" /trunk/ /branch/NEW_Branch
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
白云悠悠 2024-07-11 00:59:45

SVN 新用户的重要提示; 这可能有助于快速获取正确的 URL。

运行 svn info 来显示有关当前签出分支的有用信息。

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

另外,要切换到新创建的分支,请使用 svn switch 命令:

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

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
山川志 2024-07-11 00:59:45

如果您的存储库可通过 https 获得,您可以使用此命令进行分支...

svn copy https://host.example.com/repos/project/trunk \
       https://host.example.com/repos/project/branches/branch-name \
  -m "Creating a branch of project"

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"
自此以后,行同陌路 2024-07-11 00:59:45

使用 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"

Create a new branch using the svn copy command as follows:

$ 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"
仅此而已 2024-07-11 00:59:45

Subversion 中的分支是通过非常非常轻且高效的复制工具来实现的。

分支和标记实际上是相同的。 只需使用 svn copy 命令将存储库中的整个文件夹复制到存储库中的其他位置即可。

基本上,这意味着按照惯例复制文件夹意味着什么——无论是备份、标签、分支还是其他。 根据您想要如何思考事物(通常取决于您过去使用过的 SCM 工具),您需要在存储库中设置一个文件夹结构来支持您的风格。

常见的样式是在存储库顶部有一堆文件夹,称为 tagsbranchestrunk 等 - 允许您将整个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 whole trunk (or sub-sets) into the tags and/or branches 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.

初见 2024-07-11 00:59:45

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

  1. 右键单击本地 Windows 计算机上更新的主干
  2. 选择 TortoiseSVN
  3. 单击分支/标签
  4. 选择 SVN 存储库中的“目标”路径。 请注意,目标 URL 根据给定的路径和分支名称进行更新
  5. 不要在存储库浏览器中的分支内创建文件夹
  6. 添加分支路径。 例如,branches/
  7. 添加有意义的日志消息以供参考
  8. 单击“确定”,这将在本地系统上创建新文件夹
  9. 将创建的分支签入新文件夹

Below are the steps to create a branch from trunk using TortoiseSVN in windows machine. This obviously needs TortoiseSVN client to be installed.

  1. Right Click on updated trunk from local windows machine
  2. Select TortoiseSVN
  3. Click branch/Tag
  4. Select the To path in SVN repository. Note that destination URL is updated according to the path and branch name given
  5. Do not create folder inside branches in repository browser
  6. Add branches path. For example, branches/
  7. Add a meaningful log message for your reference
  8. Click Ok, this creates new folder on local system
  9. Checkout the branch created into new folder
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文