How to convert a GIT SVN mirror into GIT upstream

Post Syndicated from Lennart Poettering original https://0pointer.net/blog/projects/git-mirror-to-upstream.html

Yesterday I did the final steps to convert all my SVN repositories to GIT (including Avahi and PulseAudio). I had been running hot GIT mirrors of the SVN repositories for quite a while now. The last step was the switch to make them canonical upstream, and to disable the SVN repos.

For future Google reference, here are the steps that are necessary to make an SVN GIT mirror into a proper GIT repo:

# On the client:
$ git clone ssh://..../git/foobar foobar
$ cd foobar
$ git checkout trunk
$ git branch -m master
$ git push origin master
# This is a good time to edit the HEAD file on the server and replace its contents "ref: refs/heads/trunk" by "ref: refs/heads/master"
$ git push origin :trunk

This will basically replace ‘trunk‘ by ‘master‘, and make it
the default when clients clone the repository. This will however not rename
tags from the git-svn style to the GIT style. (Which I personally
think would be a bad idea anyway, BTW)

Removing the origin from the server’s config file is a good idea, too, since the repo is now canonical upstream.

Of course, afterwards you still need to create proper .gitignore
files for the repositories. Just taking the value of the old
svn:ignore property is a bad idea BTW, because .gitignore
lists patterns that are used for the directory it is placed in and
everything beneath
, while svn:ignore is not applied
recursively.

And finally you need to remove all those $Id$ lines and suchlike
from all source files since they are kind of pointless on GIT. It is left as an
excercise to the user to craft a good sed or perl script to do this
automatically and recursively for an entire tree.

Lazyweb, do you have a good idea how to integrate mutt and
git-am best? I want a key in mutt I can press which will ask me for a
GIT directory and then call git-am --interactive for the currently
selected email. Anyone got a good idea? Right now I am piping the mail from
mutt to git-am. But that sucks, because --interactive refuses to work called like that
and because I cannot specify the git repo to apply this to.