User:Emijrp/Migrating from svn to git

From Wikitech
Jump to navigation Jump to search

Here we migrate a SVN repository to a git one, more exactly, a Google Code repo to GitHub.

Preparing authors file

Create an authors.txt file with the mapping of commiters. Launch the following command, copy the output into an authors.txt file, and fill the missing fields if you want.

svn log | grep -E '^r[0-9]+' | cut -d '|' -f2 | sort | uniq | xargs -I {} echo '{} = name <email>'

Example of authors.txt content:

emijrp = emijrp <>

(no author) = name <email>

Cloning the old repo

Clone the SVN repo as git:

git svn clone wikistatistics-mediawiki-extension -A authors.txt

Later, create an empty git repo in GitHub.

Ready for the first push

Add the GitHub repo to local:

cd wikistatistics-mediawiki-extension
git remote add origin

Finally make the push:

git push -u origin master

Do you want to migrate the issues section too?

Google Code includes an issue section for bug reporting. You can migrate most of its content using the script google-code-issues-migrator.

python google-repo-name your-github-username [github-repo-name OR organisation/github-repo-name]

Do you want to migrate the Google Code wiki too?

In the GitHub repo, click on create wiki. You will have an empty wiki, perhaps with a

Now, download the wiki directory of Google Code as a repo and import it into the GitHub wiki, which is a repo too.

git svn clone -A authors.txt
git remote add origin
git pull origin master (to merge the before doing a git push, otherwise it will fail; Ctrl-X for exit)
git push -u origin master

After this, you will have the complete wiki history into your GitHub wiki repo. Now you can convert the old wiki syntax from Google Code to GitHub markdown.