User:Emijrp/Migrating from svn to git
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 https://wikistats-mediawiki-extension.googlecode.com/svn/trunk/ | grep -E '^r[0-9]+' | cut -d '|' -f2 | sort | uniq | xargs -I {} echo '{} = name <email>'
Example of authors.txt content:
emijrp = emijrp <emijrp@gmail.com>
(no author) = name <email>
Cloning the old repo
Clone the SVN repo as git:
git svn clone https://wikistats-mediawiki-extension.googlecode.com/svn/trunk/ 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 https://github.com/emijrp/wikistatistics-mediawiki-extension.git
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 migrateissues.py 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 HOME.md.
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 https://wikistats-mediawiki-extension.googlecode.com/svn/wiki/ wikistatistics-mediawiki-extension.wiki -A authors.txt
cd wikistatistics-mediawiki-extension.wiki
git remote add origin https://github.com/emijrp/wikistatistics-mediawiki-extension.wiki.git
git pull origin master
(to merge the HOME.md 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.