{"thread":{"id":"19983","subject":"Using git to manage multiple SVN repositories","startedAt":"2009-06-30T14:29:16Z","lastAt":"2009-06-30T14:29:16Z","messageCount":1,"participants":["Geert Bosch"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"117237","messageId":"DB544A72-AD2A-4E7D-8421-6B72A4DECF3E@adacore.com","threadId":"19983","inReplyTo":null,"subject":"Using git to manage multiple SVN repositories","fromName":"Geert Bosch","fromEmail":"bosch@adacore.com","sentAt":"2009-06-30T14:29:16Z","receivedAt":"2009-06-30T14:29:16Z","isPatch":false,"sender":{"key":"bosch@adacore.com","avatar":null},"body":"Hi all,\n\nFor my work I have to deal with various related large Subversion\nrepositories with more than 15 years of history that need\nto be kept mostly in sync, but with varying layout.\n\nAs expected, git turns out to be a truly excellent tool for this\njob. My workflow seems very non-standard though, so I'd like to\nshare it to maybe help others in similar situations and solicit\nfeedback to fine-tune my setup. Also, I have the suspicion that\nI should probably use submodules for some of this, but they\ndon't really seem to fit well.\n\nMy goal is to polish this workflow, so it's usable even by\nthose suffering from prolonged exposure to RCS and CVS.\n\nRepositories:\n\n   -- Public Subversion repository\n   public/module1/...\n      :   module2/...\n      :   moduleX/ourstuff-public/morestuff-public\n\n\n   -- Company private Subversion repository\n   private/ourstuff-private\n      :   /morestuff-private\n      :   /our-other-stuff\n\nIn my working tree, I do a svn clone of the entire\npublic repository:\n\n   %git svn clone public:/public\n\nThen, I put our private copy of moduleX inside:\n   %git svn clone private:/private/ourstuff-private\n   %rm -rf public/moduleX/ourstuff-public\n   %mv private/ourstuff-private public/moduleX/ourstuff-public\n\nFinally, as ourstuff-private does not include morestuff-private,\nI clone that part to and put it inside in a 3rd nested git repository:\n\n   % git svn clone private:/private/morestuff-private\n   % mv private/morestuff-private public/moduleX/ourstuff-public/ \nmorestuff-public\n\nNow, I can go to the toplevel public and do a\n   public% git checkout -f\n\nThis will bring in all upstream changes. Then, going to directory\npublic/moduleX/ourstuff-public, I can easily see the changes done\nupstream and (using git gui) commit those changes acceptable in\nour private repository and work on reducing the set of differences.\n\nWhen that's done, do a checkout -f in the same ourstuff-public\ndirectory (which contains the git svn clone of ourstuff-private)\nwill discard any unmerged changes. Going back to the toplevel\npublic directory, will now let me pick any of our private changes\nthat are acceptable into the public Subversion repository.\n\nFor files in the ourstuff-public directory that we don't want\n(like ChangeLog files) I put a .gitignore in ourstuff-public.\nFor private files that we intend to keep private, I add a\n.gitignore in public/moduleX, containing lines of the form\nourstuff-public/topsecretfile. Differences that I'll have to\ncarry around for a long time, I commit locally.\n\nUsing \"git svn rebase\" I can pull in any new development in either\nthe public or private Subversion repositories. This workflow is already\nlight years ahead of anything I could hope to achieve with Subversion.\nHowever, the one big thing I miss is being able to do a commit in the\noutermost git repository (the clone of the public Subversion repo),  \nwhich\nincludes the current heads of all the enclosed repositories.\n\nIt seems this is something that should be doable with git submodules,\nbut I'm not quite sure how, without messing up my somewhat non-standard\nsetup. Any hints/tips/comments are appreciated.\n\n   -Geert\n"}]}