I needed to convert several Subversion repositories to Git. Most of my process for this comes from this post. The following are some condensed steps and additional notes.
-
Work in a new
no-metadata
folder; this helps keep your working environment isolated, and will let you re-use theusers.txt
file if you need to do this to multiple repositories. Create theusers.txt
file and ensure all authors in the repo are listed. To get started, do something like this, whereSVN_URL
is the URL of the repo:svn log -q SVN_URL | awk -F " \\\\| " '/^r/ {print $2" = "$2" <>"}' | sort -u > users.txt
Note that this will preserve spaces in user names, if present (some other snippets you might find are broken and will not). Now edit
users.txt
and fill in details. You might need to add a(no author) = No Author <no@author.invalid>
line, too, if there are any commits which have no author, such as the empty ones created by some techniques that manipulate dump files to purge files. -
Use
git-svn
like this (replaceSVN_URL
with the correct URL) to clone the repo without metadata; add--stdlayout
if using standard branch folders, or as many-T
,-t [...]