删除SVN分支
我创建了一个名为“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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
当然:
svn rm
不需要的文件夹,然后提交。为了避免将来出现这种情况,我将遵循 SVN 项目的推荐布局:
/someproject/trunk
文件夹(或者只是/trunk
如果你只想放一个创建
/someproject/branches/somebranch
/someproject/tags
下 现在,当您签出工作副本时,请确保仅签出
主干
或某个单独的分支。 不要在包含所有分支的庞大工作副本中检查所有内容。11除非您知道自己在做什么,在这种情况下,您知道如何创建浅工作副本。
Sure:
svn rm
the unwanted folder, and commit.To avoid this situation in the future, I would follow the recommended layout for SVN projects:
/someproject/trunk
folder (or just/trunk
if you want to put only oneproject in the repository)
/someproject/branches/somebranch
/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.11Unless you know what you're doing, in which case you know how to create shallow working copies.
对于使用 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.)
Find the branch folder you want to delete, right-click it, and select "Delete."
Enter your commit message, and you're done.
假设此分支不是外部分支或符号链接,删除分支应该很简单:
如果您想在存储库中执行此操作,然后更新以将其从工作副本中删除,您可以执行以下操作:
然后运行:
Assuming this branch isn't an external or a symlink, removing the branch should be as simple as:
If you'd like to do this in the repository then update to remove it from your working copy you can do something like:
Then run:
您也可以直接删除远程上的分支。完成此操作后,下一次更新会将其从您的工作副本中删除。
^
是远程 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.
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.
删除分支的命令如下:
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.
您可以像结帐中的任何其他文件夹一样删除功能文件夹,然后提交更改。
为了防止将来出现这种情况,我建议您遵循 SVN 布局的命名约定。
要么在创建每个项目时给每个项目一个主干、分支、标签文件夹。
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 rm Branchs/features
svn commit -m“删除过时的功能分支”
From the working copy:
svn rm branches/features
svn commit -m "delete stale feature branch"