Convert each directory within SVN trunk to different GIT repositories

Viewed 64

I'm trying to convert a SVN repository to a GIT repository. Inside my SVN /trunk directory I have multiple directories:

/trunk
  /apps
  /site
  /services
  /scripts
/branches
  ...
/tags
  ...

If I run the command git svn clone --authors-file=authors.txt https://mysvnrepo.com.br/svn/myapp/ c:/mygitrepo it will create only one GIT repository with all directories within.

Basically what I want is to create a GIT repository for each directory inside /trunk so I would have 4 different GIT repos: apps, site, services and scripts.

Also I would like to create only GIT main branch, ignoring other SVN branches.

How can I do this with the git svn command?

1 Answers

I would recommend first converting the SVN repository into one Git repository.

Then use git filter-repo on that Git repository in order to extract 4 repositories out of 4 subfolders in it.

git filter-repo --path apps
git filter-repo --path site
git filter-repo --path services
git filter-repo --path scripts

As illustrated here.

Related