{"id":1170,"date":"2011-08-17T08:43:53","date_gmt":"2011-08-17T06:43:53","guid":{"rendered":"http:\/\/raftaman.net\/?p=1170"},"modified":"2021-05-15T11:46:39","modified_gmt":"2021-05-15T09:46:39","slug":"convert-subversion-repository-to-git","status":"publish","type":"post","link":"https:\/\/possiblelossofprecision.net\/?p=1170","title":{"rendered":"Convert subversion repository to GIT"},"content":{"rendered":"<p>First, you need to create a file that maps the subversion authors to GIT users (let&#8217;s say <code>\/tmp\/svnusers<\/code>). The syntax is pretty easy:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nkmartin = Kirk Martin &lt;marty@localhost.com&gt;\r\nmattaway = Marshal Attaway &lt;marshal@localhost.com&gt;\r\n<\/pre>\n<p>To get a list of all your SVN authors, run<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ svn log --xml | grep author | sort -u | perl -pe 's\/.&gt;(.?)&lt;.\/$1 = \/'\r\n<\/pre>\n<p>on you subversion working copy.<\/p>\n<p>Next, you have to create a temp directory (which will be cloned later to get rid of all the SVN stuff).<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ mkdir \/tmp\/MyProject_tmp\r\n$ cd \/tmp\/MyProject_tmp\r\n<\/pre>\n<p>Now, you can fetch the SVN files from you subversion server<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ git-svn init svn+ssh:\/\/user@SVNHost\/MyProject\/trunk\/ --no-metadata\r\n$ git config svn.authorsfile \/tmp\/svnusers\r\n$ git-svn fetch\r\n<\/pre>\n<p>Please note, that you may need to adjust the protocol (svn+ssh, http, https, ftp, etc.), user, host, path to the project files etc.<br \/>\nTo get rid of all the SVN remains, simply clone the newly created GIT repo<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ git clone MyProject_tmp MyProject\r\n<\/pre>\n<p>Resources and further reading:<br \/>\n<a href=\"http:\/\/progit.org\/book\/ch8-2.html\">http:\/\/progit.org\/book\/ch8-2.html<\/a><br \/>\n<a href=\"http:\/\/www.jonmaddox.com\/2008\/03\/05\/cleanly-migrate-your-subversion-repository-to-a-git-repository\/\">http:\/\/www.jonmaddox.com\/2008\/03\/05\/cleanly-migrate-your-subversion-repository-to-a-git-repository\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>First, you need to create a file that maps the subversion authors to GIT users (let&#8217;s say \/tmp\/svnusers). The syntax is pretty easy: kmartin = Kirk Martin &lt;marty@localhost.com&gt; mattaway = Marshal Attaway &lt;marshal@localhost.com&gt; To get a list of all your SVN authors, run $ svn log &#8211;xml | grep author | sort -u | perl -pe &#8216;s\/.&gt;(.?)&lt;.\/$1 = \/&#8217; on&#8230; <a href=\"https:\/\/possiblelossofprecision.net\/?p=1170\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[36],"class_list":["post-1170","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-git"],"_links":{"self":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/1170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1170"}],"version-history":[{"count":3,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/1170\/revisions"}],"predecessor-version":[{"id":1173,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/1170\/revisions\/1173"}],"wp:attachment":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}