LoginSignup
4

More than 5 years have passed since last update.

ブランチのないSVNリポジトリをGitへ移行する

Posted at

投稿練習もかねて。
SVN上で管理していたときにtrunk,branches,tagブランチを作成しなかった場合のGitへの移行方法です。

コマンド

$ git svn clone --authors-file=authors.txt http://パス名/リポジトリ名 Gitでのリポジトリ名
(例)$ git svn clone --authors-file=authors.txt http://localhost/svn/source source

おそらく[--prefix]オプションもつけられますが、今回は必要なかったため割愛しました。

補足

通常時のブランチのあるSVNの移行は下記の通りです。

$ git svn clone --stdlayout --prefix=svn/ --authors-file=authors.txt http://SVNパス名/SVNリポジトリ名 Gitでのリポジトリ名
(例)$ git svn clone --stdlayout --prefix=svn/ --authors-file=authors.txt http://localhost/svn/source source

上と比べると[--stdrayout]オプション以外に差がないことに気がつきました。
以下Git Bashからgit help svnしたときの[--stdlayout]オプション内容の抜粋です。

--stdlayout
These are optional command-line options for init. Each of these flags can point to a relative repository path (--tags=project/tags) or a full url (--tags=https://foo.org/project/tags). You can specify more than one --tags and/or --branches options, in case your Subversion repository places tags or branches under multiple paths. The option --stdlayout is a shorthand way of setting trunk,tags,branches as the relative paths, which is the Subversion default. If any of the other options are given as well, they take precedence.

「[--stdlayout]オプションはtrunk,tags,branchesを簡単に設定するオプション」なので、ブランチがないリポジトリはこれを省くと良いようです。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4