删除SVN分支

发布于 2024-09-25 06:59:51 字数 127 浏览 4 评论 0原文

我创建了一个名为“features”的 SVN 项目分支,现在每当我尝试更新该项目时,它都会带来一个 features 文件夹,其中包含该分支中该项目的另一个副本。

有没有办法从存储库中完全删除分支,这样就不会再发生这种情况?

I created a branch of an SVN project called 'features', and now whenever I try to update said project, it brings with it a features folder, which contains another copy of the project from the branch.

Is there a way to remove the branch from the repository completely so that this doesn't happen any more?

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

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

发布评论

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

评论(7

舟遥客 2024-10-02 06:59:51

当然:svn rm 不需要的文件夹,然后提交。

为了避免将来出现这种情况,我将遵循 SVN 项目的推荐布局

  • 将代码放在
    /someproject/trunk 文件夹(或者只是
    /trunk 如果你只想放一个
    创建
  • 分支为 /someproject/branches/somebranch
  • 将标签放在 /someproject/tags

下 现在,当您签出工作副本时,请确保仅签出主干或某个单独的分支。 不要在包含所有分支的庞大工作副本中检查所有内容。1

1除非您知道自己在做什么,在这种情况下,您知道如何创建浅工作副本。

Sure: svn rm the unwanted folder, and commit.

To avoid this situation in the future, I would follow the recommended layout for SVN projects:

  • Put your code in the
    /someproject/trunk folder (or just
    /trunk if you want to put only one
    project in the repository)
  • Created branches as /someproject/branches/somebranch
  • Put tags under /someproject/tags

Now when you check out a working copy, be sure to check out only trunk or some individual branch. Don't check everything out in one huge working copy containing all branches.1

1Unless you know what you're doing, in which case you know how to create shallow working copies.

灯下孤影 2024-10-02 06:59:51

对于使用 TortoiseSVN 的用户,您可以使用存储库浏览器(在上下文菜单中标记为“Repo-browser”)来完成此操作。

上下文菜单

找到要删除的分支文件夹,右键单击它,然后选择“删除”。

删除文件夹

输入您的提交消息,然后就完成了。

提交

For those using TortoiseSVN, you can accomplish this by using the Repository Browser (it's labeled "Repo-browser" in the context menu.)

context menu

Find the branch folder you want to delete, right-click it, and select "Delete."

deleting the folder

Enter your commit message, and you're done.

committing

假面具 2024-10-02 06:59:51

假设此分支不是外部分支或符号链接,删除分支应该很简单:

svn rm branches/< mybranch >

svn ci -m "message"

如果您想在存储库中执行此操作,然后更新以将其从工作副本中删除,您可以执行以下操作:

svn rm http://< myurl >/< myrepo >/branches/< mybranch >

然后运行:

svn update

Assuming this branch isn't an external or a symlink, removing the branch should be as simple as:

svn rm branches/< mybranch >

svn ci -m "message"

If you'd like to do this in the repository then update to remove it from your working copy you can do something like:

svn rm http://< myurl >/< myrepo >/branches/< mybranch >

Then run:

svn update
2024-10-02 06:59:51

您也可以直接删除远程上的分支。完成此操作后,下一次更新会将其从您的工作副本中删除。

svn rm "^/reponame/branches/name_of_branch" -m "cleaning up old branch name_of_branch"

^ 是远程 URL 的缩写,如“svn info”中所示。双引号在 Windows 命令行中是必需的,因为 ^ 是一个特殊字符。

如果您从未签出该分支,此命令也将起作用。

You can also delete the branch on the remote directly. Having done that, the next update will remove it from your working copy.

svn rm "^/reponame/branches/name_of_branch" -m "cleaning up old branch name_of_branch"

The ^ is short for the URL of the remote, as seen in 'svn info'. The double quotes are necessary on Windows command line, because ^ is a special character.

This command will also work if you have never checked out the branch.

梅窗月明清似水 2024-10-02 06:59:51

删除分支的命令如下:

svn delete -m "" <分支网址>

如果您不想获取/签出整个存储库,请在终端上执行以下命令:

1) 获取包含工作副本的目录的绝对路径
>密码
2) 启动svn代码签出
> svn checkout <分支网址> <从点1开始的绝对路径>

上述步骤将为您提供分支文件夹内的文件,而不是整个文件夹。

Command to delete a branch is as follows:

svn delete -m "<your message>" <branch url>

If you wish to not fetch/checkout the entire repo, execute the following command on your terminal:

1) get the absolute path of the directory that will contain your working copy
> pwd
2) Start svn code checkout
> svn checkout <branch url> <absolute path from point 1>

The above steps will get you the files inside the branch folder and not the entire folder.

高速公鹿 2024-10-02 06:59:51

您可以像结帐中的任何其他文件夹一样删除功能文件夹,然后提交更改。

为了防止将来出现这种情况,我建议您遵循 SVN 布局的命名约定。

要么在创建每个项目时给每个项目一个主干、分支、标签文件夹。

svn
+ project1
  + trunk
    + src
    + etc...
  + branches
    + features
      + src
      + etc...
  + tags
+ project2
  + trunk
  + branches
  + tags

You can delete the features folder just like any other in your checkout then commit the change.

To prevent this in the future I suggest you follow the naming conventions for SVN layout.

Either give each project a trunk, branches, tags folder when they are created.

svn
+ project1
  + trunk
    + src
    + etc...
  + branches
    + features
      + src
      + etc...
  + tags
+ project2
  + trunk
  + branches
  + tags
黄昏下泛黄的笔记 2024-10-02 06:59:51

从工作副本:

svn rm Branchs/features
svn commit -m“删除过时的功能分支”

From the working copy:

svn rm branches/features
svn commit -m "delete stale feature branch"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文