{"id":197,"date":"2018-08-04T11:26:30","date_gmt":"2018-08-04T09:26:30","guid":{"rendered":"https:\/\/gigerstyle.selfhost.ch\/?p=197"},"modified":"2018-08-04T11:35:45","modified_gmt":"2018-08-04T09:35:45","slug":"svn2git-migration","status":"publish","type":"post","link":"https:\/\/gigerstyle.selfhost.ch\/?p=197","title":{"rendered":"Svn2Git migration"},"content":{"rendered":"<p><code><br \/>\n#!\/bin\/bash<\/p>\n<p># This script works for svn repos without branches and tags. Additional steps required to migrate branches too.<br \/>\n# all directories under &lt;svn-repo-uri&gt; (e.g.https:\/\/&lt;svn-host&gt;\/svn\/repos) will be migrated to a separate git repo:<br \/>\nREPOS=$(svn ls &lt;svn-repo-uri&gt;)<\/p>\n<p>for repo in $(echo $REPOS | sed -e 's\/\\\/\/\\n\/g')<br \/>\ndo<br \/>\n    git svn clone --no-metadata --authors-file=users.txt &lt;svn-repo-uri&gt;\/\"${repo}\" \"${repo}\"-tmp.git<br \/>\n    git clone \"${repo}\"-tmp.git \"${repo}\".git<br \/>\n    rm -rf \"${repo}\"-tmp.git<br \/>\n    cd \"${repo}\".git<br \/>\n    git remote rm origin<br \/>\n    # : e.g. git@&lt;git-host&gt;:&lt;git-repo-path&gt;<br \/>\n    git remote add origin git@&lt;git-host&gt;:&lt;git-repo-path&gt;\/\"${repo}\".git<br \/>\n    git push origin master<br \/>\n    git branch --set-upstream-to=origin\/master master<br \/>\n    cd ..<br \/>\n    rm -rf \"${repo}\".git<br \/>\ndone<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>#!\/bin\/bash # This script works for svn repos without branches and tags. Additional steps required to migrate branches too. # all directories under &lt;svn-repo-uri&gt; (e.g.https:\/\/&lt;svn-host&gt;\/svn\/repos) will be migrated to a separate git repo: REPOS=$(svn ls &lt;svn-repo-uri&gt;) for repo in $(echo $REPOS | sed -e &#8216;s\/\\\/\/\\n\/g&#8217;) do git svn clone &#8211;no-metadata &#8211;authors-file=users.txt &lt;svn-repo-uri&gt;\/&#8221;${repo}&#8221; &#8220;${repo}&#8221;-tmp.git git clone &hellip; <a href=\"https:\/\/gigerstyle.selfhost.ch\/?p=197\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Svn2Git migration<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[6,5],"class_list":["post-197","post","type-post","status-publish","format-standard","hentry","category-computer","tag-git","tag-svn"],"_links":{"self":[{"href":"https:\/\/gigerstyle.selfhost.ch\/index.php?rest_route=\/wp\/v2\/posts\/197","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigerstyle.selfhost.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gigerstyle.selfhost.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gigerstyle.selfhost.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gigerstyle.selfhost.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=197"}],"version-history":[{"count":3,"href":"https:\/\/gigerstyle.selfhost.ch\/index.php?rest_route=\/wp\/v2\/posts\/197\/revisions"}],"predecessor-version":[{"id":201,"href":"https:\/\/gigerstyle.selfhost.ch\/index.php?rest_route=\/wp\/v2\/posts\/197\/revisions\/201"}],"wp:attachment":[{"href":"https:\/\/gigerstyle.selfhost.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gigerstyle.selfhost.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gigerstyle.selfhost.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}