3

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?

ragu89
  • 335
  • 7
  • 22

3 Answers3

1

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)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

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.

ragu89
  • 335
  • 7
  • 22
  • That looks like https://github.com/nirvdrum/svn2git/issues/91, an open issue unfortunately. – VonC Jul 16 '14 at 06:54
  • Ok, I have deleted all the @XX branches and tags. Now it only remains the svn remote branches : remotes/svn/trunk, remotes/svn/trunk@123, etc. How to remove these branches? – ragu89 Jul 16 '14 at 07:06
  • You can try and remove the remote reference: `git remote remove svn`,and remove the remote tracking branches (http://stackoverflow.com/a/17029936/6309) – VonC Jul 16 '14 at 07:49
  • Make sure though that the branches you deleted weren't with history that you needed. You might had to rebase them on top of trunk instead of just deleting them. – VonC Jul 16 '14 at 07:50
  • I could delete all the undesirable branches with git branch -rd. Thank you for your help! – ragu89 Jul 16 '14 at 14:18
1

This works for me:

git branch -rd tags/1.0 tags/2.0 
Minh Nguyen
  • 2,106
  • 1
  • 28
  • 34