简体   繁体   English

Git - 在 git-svn 克隆后删除远程分支

[英]Git - Remove remote branches after git-svn clone

I have cloned a SVN repo with the command git svn clone ... --trunk=trunk --tags=tags --branches=branches .我已经使用命令git svn clone ... --trunk=trunk --tags=tags --branches=branches克隆了一个SVN repo。

The operation have been correctly executed, and now when I list my branches I have all the past tags such as :操作已正确执行,现在当我列出我的分支时,我拥有所有过去的标签,例如:

$ git branch -a
* master
  remotes/tags/1.0
  remotes/tags/2.0

I can easily checkout the branches and creates real git tags, but how can I remove the remote branch remotes/tags/1.0 when I'm done?我可以轻松地检出分支并创建真正的 git 标签,但是如何在完成后删除远程分支remotes/tags/1.0

Another option would be to try and import the svn repo with the ruby script svn2git :另一种选择是尝试使用ruby 脚本 svn2git导入 svn repo:

svn2git is a tiny utility for migrating projects from Subversion to Git while keeping the trunk, branches and tags where they should be. svn2git是一个微型实用程序,用于将项目从 Subversion 迁移到 Git,同时将主干、分支和标签保留在它们应有的位置。

That means the 'svn branches' tags would be actual git tags in the git repo.这意味着“svn 分支”标签将是 git 存储库中的实际 git 标签。

( you might have to change the authors after import ) 您可能需要在导入后更改作者

Ok, I did it with the command svn2git http://myrepo/myproject --nobranches好的,我用命令svn2git http://myrepo/myproject --nobranches

Now when I list my branches :现在当我列出我的分支时:

$ git branch -a
* master
  trunk@123
  trunk@400
  trunk@400-
  trunk@476
  trunk@476-
  remotes/svn/trunk
  remotes/svn/trunk@123
  remotes/svn/trunk@400
  remotes/svn/trunk@400-
  remotes/svn/trunk@476
  remotes/svn/trunk@476-

What means the branches @XXX ?分支@XXX是什么意思? How to remove all of it?如何将其全部删除?

I have the same behaviour with a tag :我对标签有相同的行为:

$ git tag
1.0
2.0
2.0@155
3.0

Finally, I only want to recover my trunk in the master and my tags in the git tag.最后,我只想恢复我在 master 中的主干和我在 git 标签中的标签。

这对我有用:

git branch -rd tags/1.0 tags/2.0 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM