When moving your project repositories from Google Code to GitHub, the migration from SVN to Git is supported by a a rich toolset.
- You can either use git-svn (atlassian provides a comprehensive tutorial, or see this concise blogpost).
- It is even more convenient to GitHub’s SVN porter. It provides less options and might not be suitable for all imports, though.
- Another alternative is svn2Git (which uses git-svn under the hood)
But what about the project wikis?
There’s this tutorial, that also contains a python tool to convert the syntax. I somehow didn’t manage to get it to work.
As I had only few pages to migrate, I pragmatically decided to do it manually.
Here are the steps that were performed
- On your github repo, create the first wiki page (which creates the wiki, effectively).
- Clone the wiki via git (it’s much more comfortable to work on a local copy):
git clone https://github.com/<user>/<repo>.wiki.git
- Copy the Google Code wiki files into your local clone.
- Replace the file endings to
.md
- If your Google Code wiki featured a sidebar, rename your sidebar file to
_Sidebar.md
. The links are converted later on. - For each wiki page do the following steps
- Convert bold words, replace the regex
\*(.*)\*
by
**\1**
- Convert italic words, replace
_word_
by
*word*
- Replace headings for all levels
= Heading1 =
to* Heading1
== Heading2 ==
to** Heading2
- And so on
- Convert links, by replacing the regex
\[([^\s]*) (.*?)]
by
[[\2|\1]]
For anchors (starting with#
) make all characters lowercase and replace underscores (_
) by minus (-
). - Replace
<code>
or{{{
by
``` java
(replace java by any other available highlighter). - Replace
</code>
or}}}
by
```
(make sure to always have the```
in a new line). - Remove
#summary
. Leave the text after it as is. - Remove the line that starts with
#sidebar
on each page. - Convert ordered lists: replace the remaining
#
by
1. - Convert unordered lists: Replace
-
by
*
- Convert bold words, replace the regex
- Push the changes upstream.
- Manually compare each page of the old version with the new version.
- You might have to adjust the layout of the sidebar a bit.
- Delete the google code wiki from your source code repository
Note that these steps were sufficient for the paricular repo I moved over. Thus, this list is definitely not complete. You might recognize that more transformations might be necessary for you. That’s why step 7 is extra important!
Please comment on any rules I left out.