Converting a local svn repo dump to git

  1. All (?) svn -> git converters require live Subversion repository,
  2. Tree-copy of repository is not a dump, it's usual file-level backup.

You have:

  1. Install and configure any Subversion server (if your converter can't handle file:/// protocol for SVN, otherwise it's not needed - just unpack tarball(s) and check repo with svn client)
  2. Read about git-svn
  3. Use git-svn

Retrieve a list of all Subversion committers:

svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt

Clone the Subversion repository using git-svn:

git svn clone [SVN repo URL] --no-metadata -A authors-transform.txt --stdlayout ~/temp

Convert svn:ignore properties to .gitignore:

cd ~/temp
git svn show-ignore > .gitignore
git add .gitignore
git commit -m 'Convert svn:ignore properties to .gitignore.'

Push repository to a bare git repository:

git init --bare ~/new-bare.git
cd ~/new-bare.git
git symbolic-ref HEAD refs/heads/trunk

Then push the temp repository to the new bare repository.

cd ~/temp
git remote add bare ~/new-bare.git
git config remote.bare.push 'refs/remotes/*:refs/heads/*'
git push bare

Rename “trunk” branch to “master”:

cd ~/new-bare.git
git branch -m trunk master

Clean up branches and tags:

cd ~/new-bare.git
git for-each-ref --format='%(refname)' refs/heads/tags |
cut -d / -f 4 |
while read ref
do
  git tag "$ref" "refs/heads/tags/$ref";
  git branch -D "tags/$ref";
done

Reference: http://john.albin.net/git/convert-subversion-to-git


install subversion locally in order to import your dump, then with git-svn package.

You can use git svn clone file:///path/to/svn/repo /path/to/empty/dir