[developers] Infrastructure notes: svn to git

goodman.m.w at gmail.com goodman.m.w at gmail.com
Sat Jul 18 08:11:50 CEST 2020


Hello, this is my second email about infrastructure changes. Since I
recently performed the import of the Matrix repository from SVN to Git and
had some success (and some failures), I have some suggestions. I used
git-svn for this, but some points are general. Also, most points are valid
regardless of the host (whether it's GitHub, GitLab, Bitbucket, your own
server, etc.).

- If your repository encompasses multiple projects, consider taking this
opportunity to split them into separate Git repositories. Unlike SVN, a Git
repository is easy to move around (on your local disk or to a new host), so
there's less reason to one repo for multiple projects.

- Use the --authors-file option to map SVN usernames to those of the
destination host; e.g., if going to GitHub, map to $
username at users.noreply.github.com so their personal email is not exposed.

- If your code relies on the presence of empty directories, use
--preserve-empty-dirs, as Git doesn't keep empty directories (the option
places a dummy file in each empty dir).

- If you're *moving* to Git and not mirroring, look into changing --prefix
to avoid ambiguous branch names (the default sets up the SVN repo like a
remote repository at origin/, which is also used when cloning from other
remotes, I think).

- Use --stdlayout if your SVN repo has the normal branches/, tags/, and
trunk/ split (otherwise use -b, -t, and -T to set these separately). It
will recreate the repo with Git's more efficient branching model than
creating subdirectories as in SVN.

- After the import (especially when moving and not mirroring), create a tag
that points to the last commit from SVN. This is mainly in case you later
wish to see the state of the repository before the move.

- DON'T delete the Git repo you create in this way after it's pushed
somewhere else. It contains metadata, which doesn't get pushed to the
remote, for reconnecting to the SVN repo. If the SVN repo has new commits
after the import, you'll need that metadata to apply them on top of the Git
repo (maybe it's possible without the metadata, but I couldn't figure it
out).

I also have some suggestions for migrating a Trac instance to GitHub
Issues, if anyone is dealing with that, but I won't send a separate email
unless people are interested.

-- 
-Michael Wayne Goodman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.delph-in.net/archives/developers/attachments/20200718/8078d2ef/attachment.html>


More information about the developers mailing list