{"id":1511,"date":"2007-07-15T12:56:41","date_gmt":"2007-07-15T16:56:41","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/2007\/07\/15\/subversion-to-git\/"},"modified":"2007-07-15T12:56:41","modified_gmt":"2007-07-15T16:56:41","slug":"subversion-to-git","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2007\/07\/15\/subversion-to-git\/","title":{"rendered":"Subversion to Git"},"content":{"rendered":"<p>\r\nI never liked CVS\u2014the limitations and design flaws become obvious almost as soon as you start using it\u2014but after years of use it was a familiar model that worked well enough in practice. Then came <a href=\"http:\/\/subversion.tigris.org\/\">Subversion<\/a>. It worked like CVS but fixed the glaring problems, providing atomic commits, the ability to move files and folders, checksumming, revision numbers that represent whole trees, and easier tagging and branching (albeit by shoe-horning them into the tree). <a href=\"http:\/\/mjtsai.com\/blog\/2004\/08\/30\/cvs2svn\/\">Switching<\/a> was an easy decision. I remained happy with it, especially with the more reliable FSFS backend and the <a href=\"http:\/\/mjtsai.com\/blog\/2006\/09\/12\/subversion-14\/\">new working copy format<\/a>. I was aware that Subversion had some problems, but none were too bothersome, and as a solo developer I knew I didn\u2019t need a distributed version control system.\r\n<\/p>\r\n<p>\r\nThen I heard about <a href=\"http:\/\/git.or.cz\">Git<\/a> when I happened to watch a <a href=\"http:\/\/www.youtube.com\/watch?v=4XpnKHJAok8\">video<\/a> of its creator, Linus Torvalds. It had not occurred to me that CVS and Subversion were fundamentally broken. Torvalds is undeniably a smart guy, but he\u2019s also known for his bluster. I\u2019d heard Git mentioned a few times before, usually in the context of it being difficult to use, something only a kernel developer could love. So I was skeptical but interested enough to try it out.\r\n<\/p>\r\n<p>\r\nWhat I found is that Torvalds\u2019s bragging is justified. Learning about Git after using other version control systems is somewhat like learning a new programming language that\u2019s radically different from what you\u2019ve known before. Even if you might not need the more unusual features most of the time, you feel as though your eyes have been opened, your mind expanded.\r\n<\/p>\r\n<p>\r\nBeyond just the distributed model, Git\u2019s <a href=\"http:\/\/www.kernel.org\/pub\/software\/scm\/git\/docs\/user-manual.html\">implementation<\/a> is beautiful. It stores the repository in such a logical way, using far fewer files and much less disk space than Subversion. Each file, no matter its location in the tree or history is only stored once. The repository is stored in a single <tt>.git<\/tt> folder at the top level of your working directory. In addition to its repository, Subversion needs a <tt>.svn<\/tt> folder inside each folder of the working directory. The working directory holds two extra files (one for the data and one for the properties) for each file, plus some more file and folders for each directory. Git needs none of these. It\u2019s more efficient, and you don\u2019t need to make sure all your tools have special handling for the invisible <tt>.svn<\/tt> folders.\r\n<\/p>\r\n<p>\r\nGit\u2019s implementation is compact. It doesn\u2019t rely on a ton of other libraries, and the tar.bz2 file is only 1.1 MB. Compiling Git took only 15 seconds on my Mac, compared to <a href=\"http:\/\/mjtsai.com\/blog\/2006\/02\/04\/subversion-compilation-benchmarks\">104 seconds for Subversion<\/a>.\r\n<\/p>\r\n<p>\r\nThe user interface is currently a bit rougher than Subversion\u2019s, but it\u2019s not too bad, and some things are actually nicer. Unfortunately, the <a href=\"http:\/\/www.kernel.org\/pub\/software\/scm\/git\/docs\/\">man pages<\/a> and <a href=\"http:\/\/www.kernel.org\/pub\/software\/scm\/git\/docs\/user-manual.html\">manual<\/a>\r\ndon\u2019t build out of the box on Mac OS X, so I recommend reading them online, along with the <a href=\"http:\/\/www.kernel.org\/pub\/software\/scm\/git\/docs\/core-tutorial.html\">tutorial<\/a>.\r\n<\/p>\r\n<p>\r\nIn order to migrate from Subversion I needed to install LWP:\r\n<\/p>\r\n<pre>\r\nsudo perl -MCPAN -e shell\r\ninstall Bundle::LWP\r\n<\/pre>\r\n<p>\r\nand a different build of Subversion that included the <a href=\"http:\/\/downloads.open.collab.net\/binaries.html\">Perl bindings<\/a>. With <tt>\/usr\/local\/lib\/svn-perl<\/tt> in my <tt>PERL5LIB<\/tt> I was then able to use the <tt>git-svnimport<\/tt> import command, but I found that this didn\u2019t work very well, perhaps because one of my Subversion repositories didn\u2019t use the traditional branches\/tags\/trunk structure. I had much better luck with:\r\n<\/p>\r\n<pre>\r\ngit-svn init -T &lt;svn-repos&gt; &lt;svn-repos&gt;\r\ngit-svn fetch\r\n<\/pre>\r\n<p>\r\nSo far I\u2019ve moved two Subversion repositories to Git. Before I move my main development repository I want to write some shell aliases to make it a bit smoother to use, and some scripts to integrate it with BBEdit.\r\n<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>I never liked CVS\u2014the limitations and design flaws become obvious almost as soon as you start using it\u2014but after years of use it was a familiar model that worked well enough in practice. Then came Subversion. It worked like CVS but fixed the glaring problems, providing atomic commits, the ability to move files and folders, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1511","post","type-post","status-publish","format-standard","hentry","category-programming-category"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/1511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=1511"}],"version-history":[{"count":0,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/1511\/revisions"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=1511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=1511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=1511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}