简体   繁体   中英

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 .

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?

Another option would be to try and import the svn repo with the ruby script svn2git :

svn2git is a tiny utility for migrating projects from Subversion to Git while keeping the trunk, branches and tags where they should be.

That means the 'svn branches' tags would be actual git tags in the git repo.

( you might have to change the authors after import )

Ok, I did it with the command 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 ? 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.

这对我有用:

git branch -rd tags/1.0 tags/2.0 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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