Skip to content

Instantly share code, notes, and snippets.

@ktx2207
Last active August 29, 2015 14:05
Show Gist options
  • Save ktx2207/a89b22772b624fe4bce9 to your computer and use it in GitHub Desktop.
Save ktx2207/a89b22772b624fe4bce9 to your computer and use it in GitHub Desktop.
SVNからGitへの移行

SVNからGitへの移行

Gitへの移行を参考にSVNからGitへの移行を行ったのでメモ。

対象のソースをチェックアウト

$ svn checkout https://remote-server/svn/sample

SVN で使っている作者の一覧を取得する

 $ svn log ^/ --xml | grep -P "^<author" | sort -u | perl -pe 's/<author>(.*?)<\/author>/$1 = /' > users.txt
 

users.txtの出力は下記のようになる。

moyaji = Yaji Mo <[email protected]>
tarou = Tarou Suzuki <[email protected]>

users.txtを用いてgit svn cloneを実行

git svn clone https://remote-server/svn/sample --authors-file=users.txt --no-metadata -s sample

リモートでベアリポジトリ作成

$ mkdir -p git/bare/sample.git  
$ cd git/bare/sample.git  
$ git --bare init --share

リモートリポジトリを登録

$ git remote add origin ssh://username@remote_server/git/bare/sample.git

git svn cloneで得られたリポジトリをリモートリポジトリへ送信

$ git push -u origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment