# Migrate an svn repo to git - Where did all the branches got? and tags?

4 messages from 2010-05-21 to 2010-05-21. Participants: Jack Moore, Thomas Rast, Ævar Arnfjörð Bjarmason.
Thread: https://gitlist.dev/t/23862

## Jack Moore, 2010-05-21 04:20

Subject: Migrate an svn repo to git - Where did all the branches got? and tags?
Message-ID: <CFE20E75-F23D-41EA-89AA-2FF59BFA5DF9@verizon.net>
URL: https://gitlist.dev/e/CFE20E75-F23D-41EA-89AA-2FF59BFA5DF9%40verizon.net

```
All,

I have a subversion repository with the usual structure

svn-repo
  |
  +-branches
      +-release1
      +-release2
  +-tags
      +-r1dev
      +-r1test
      +-r2dev
      +-r2test
  +-trunk

that I want to migrate to git.

I cloned the svn repo with

   git svn clone --no-metadata -t tags -b branches -T trunk <repo-url>

I used the example in the Pro Git book.

the cloned repo has files 

  git-repo/.git/refs/heads/master
  git-repo/.git/refs/remotes/trunk

directory

  git-repo/.git/refs/tags

is empty.

Directories git-repo/.git/logs/... have files corresponding to the branches and tags, but they do not appear to reference git objects.

There are unhandled.log.gz files in the .git/svn directory for each branch and tag.

If I do a 

	git branch -r

the branches and tags show up as remote branches.
gitk appears to show all of the commits, but I do not see any of the branches and tags.

I would like to make the branches and tags to appear al local to git repo.

Is there a way to do this?

```

## Thomas Rast, 2010-05-21 09:41

Subject: Re: Migrate an svn repo to git - Where did all the branches got? and tags?
Message-ID: <201005211141.45664.trast@student.ethz.ch>
URL: https://gitlist.dev/e/201005211141.45664.trast%40student.ethz.ch
In-Reply-To: <CFE20E75-F23D-41EA-89AA-2FF59BFA5DF9@verizon.net>

```
Jack Moore wrote:
>    git svn clone --no-metadata -t tags -b branches -T trunk <repo-url>
[...]
>   git-repo/.git/refs/tags
> 
> is empty.
[...]
> If I do a 
> 
> 	git branch -r
> 
> the branches and tags show up as remote branches.

That's how git-svn currently works.

To turn all remote branches into local branches you can use the
following trick (don't do this in any repo other than a fresh git-svn
clone unless you understand what it does!):

  git fetch . 'refs/remotes/*:refs/heads/*'

To further clean up history and turn svn tagging commits into real
tags, you can refer, e.g., to the last section of

  http://kb.curseforge.com/repositories/convert-svn-to-git/

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

```

## Jack Moore, 2010-05-21 13:57

Subject: Re: Migrate an svn repo to git - Where did all the branches got? and tags?
Message-ID: <6E5E7194-CDE0-4D39-BD36-B837030C261B@verizon.net>
URL: https://gitlist.dev/e/6E5E7194-CDE0-4D39-BD36-B837030C261B%40verizon.net
In-Reply-To: <201005211141.45664.trast@student.ethz.ch>

```
Thx, Thomas

```

## Ævar Arnfjörð Bjarmason, 2010-05-21 16:11

Subject: Re: Migrate an svn repo to git - Where did all the branches got? and tags?
Message-ID: <AANLkTinE8TyUB43ZACRXo8U0ghgnQ9cbBOkcl0zBJlWm@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTinE8TyUB43ZACRXo8U0ghgnQ9cbBOkcl0zBJlWm%40mail.gmail.com
In-Reply-To: <6E5E7194-CDE0-4D39-BD36-B837030C261B@verizon.net>

```
On Fri, May 21, 2010 at 13:57, Jack Moore <jhmoore719@verizon.net> wrote:
> Thx, Thomas

If your history isn't too crazy you might want to try converting with
snerp-vortex instead of git-svn.

It isn't always better (or indeed, often), but might be in your case.

```
