{"thread":{"id":"21391","subject":"git svn branch tracking + ignore paths","startedAt":"2009-10-27T23:00:54Z","lastAt":"2009-10-29T01:53:05Z","messageCount":7,"participants":["Lachlan Deck","Avery Pennarun"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"126065","messageId":"41F0F1D6-4F99-4828-9259-1B2BDC689747@gmail.com","threadId":"21391","inReplyTo":null,"subject":"git svn branch tracking + ignore paths","fromName":"Lachlan Deck","fromEmail":"lachlan.deck@gmail.com","sentAt":"2009-10-27T23:00:54Z","receivedAt":"2009-10-27T23:00:54Z","isPatch":false,"sender":{"key":"lachlan.deck@gmail.com","avatar":"https://gravatar.com/avatar/d889ccc1f4816ed537181f076603b79f23f4eb000375824ddfdbecb3df85411c?d=mp&s=160"},"body":"Hi there,\n\n(Note: relative newby)\n\nI'm wondering if it's possible to create a branch (starting as local  \nbut later on pushed to svn) that essentially stays in sync with the  \nmain branch (svn trunk) but both (a) ignores pulling in certain paths  \nfrom trunk and (b) provides a few extra paths of its own (some of  \nwhich overlap with those ignored from trunk) and (c) only pushes to  \ntrunk paths that are relevant for trunk (i.e., not specifically  \nignored)?\n\nIf someone's able to share how they'd go about setting this up that'd  \nbe great.\n\nThanks!\n\nwith regards,\n--\n\nLachlan Deck\n"},{"id":"126067","messageId":"32541b130910271616ha861d08xa4b90b822d31f0ea@mail.gmail.com","threadId":"21391","inReplyTo":"41F0F1D6-4F99-4828-9259-1B2BDC689747@gmail.com","subject":"Re: git svn branch tracking + ignore paths","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2009-10-27T23:16:20Z","receivedAt":"2009-10-27T23:16:20Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Tue, Oct 27, 2009 at 7:00 PM, Lachlan Deck <lachlan.deck@gmail.com> wrote:\n> I'm wondering if it's possible to create a branch (starting as local but\n> later on pushed to svn) that essentially stays in sync with the main branch\n> (svn trunk) but both (a) ignores pulling in certain paths from trunk and (b)\n> provides a few extra paths of its own (some of which overlap with those\n> ignored from trunk) and (c) only pushes to trunk paths that are relevant for\n> trunk (i.e., not specifically ignored)?\n>\n> If someone's able to share how they'd go about setting this up that'd be\n> great.\n\nThis sounds like a generally scary idea.  Perhaps if you described\nyour problem at a higher level (what are you really trying to\nachieve?) there would be a less scary way to do it.\n\nThat said, if you *really* need this... one option that comes to mind is:\n\n1. extract the history from svn into git using 'git svn' as usual.\n\n2. extract the subtree of svn that you're interested in (if you're\nlucky enough that you only need one subtree) by using 'git subtree\nsplit'.  This creates a new branch or new git repo, depending how you\ndo it.\n\n3. Create a third project that will host your new work with extra\nsubtrees that you don't want.  Use 'git subtree add' and 'git subtree\nmerge' to keep this up to date with the stuff you extracted in step 2.\n (Repeat steps 1-3 as necessary to keep your project up to date with\nthe svn project.)\n\n4. When you want to merge your own changes back into svn, first\nextract them from your own project (step 3) using 'git subtree split'.\n Then merge those changes into the main project (step 1) using 'git\nsubtree merge'.  Then use git-svn to upload them to the main svn repo.\n\nYou can save yourself some steps if you import the *entire* svn\nproject into your own project, rather than trying to trim it on\nimport.  That way you only have to split when going from #3 to #1, not\nin the other direction, and you don't need repository #2.\n\nIf all this sounds crazy, it probably is.  Maybe see if you can come\nup with a way to avoid trying to do this altogether.\n\nGood luck... :)\n\nAvery\n\n[1] http://github.com/apenwarr/git-subtree\n"},{"id":"126080","messageId":"AC7B0CB1-1B14-4EAE-A6B6-D0845EACE626@gmail.com","threadId":"21391","inReplyTo":"32541b130910271616ha861d08xa4b90b822d31f0ea@mail.gmail.com","subject":"Re: git svn branch tracking + ignore paths","fromName":"Lachlan Deck","fromEmail":"lachlan.deck@gmail.com","sentAt":"2009-10-28T03:00:55Z","receivedAt":"2009-10-28T03:00:55Z","isPatch":false,"sender":{"key":"lachlan.deck@gmail.com","avatar":"https://gravatar.com/avatar/d889ccc1f4816ed537181f076603b79f23f4eb000375824ddfdbecb3df85411c?d=mp&s=160"},"body":"On 28/10/2009, at 10:16 AM, Avery Pennarun wrote:\n\n> On Tue, Oct 27, 2009 at 7:00 PM, Lachlan Deck  \n> <lachlan.deck@gmail.com> wrote:\n>> I'm wondering if it's possible to create a branch (starting as  \n>> local but\n>> later on pushed to svn) that essentially stays in sync with the  \n>> main branch\n>> (svn trunk) but both (a) ignores pulling in certain paths from  \n>> trunk and (b)\n>> provides a few extra paths of its own (some of which overlap with  \n>> those\n>> ignored from trunk) and (c) only pushes to trunk paths that are  \n>> relevant for\n>> trunk (i.e., not specifically ignored)?\n>>\n>> If someone's able to share how they'd go about setting this up  \n>> that'd be\n>> great.\n>\n> This sounds like a generally scary idea.  Perhaps if you described\n> your problem at a higher level (what are you really trying to\n> achieve?) there would be a less scary way to do it.\n\n:) Sure. Essentially a project that I'm contributing to has both maven  \npoms and ant/lib-based configs (with the ant ones as default for  \neclipse .project etc files). I'd like to be able to import the  \nprojects with maven into Eclipse to work on things but without  \ncommitting back changes to eclipse .project/.classpath/.settings/*.\n\nSo I'm hoping for a fairly transparent process.\n\n> That said, if you *really* need this... one option that comes to  \n> mind is:\n>\n> 1. extract the history from svn into git using 'git svn' as usual.\n>\n> 2. extract the subtree of svn that you're interested in (if you're\n> lucky enough that you only need one subtree) by using 'git subtree\n> split'.  This creates a new branch or new git repo, depending how you\n> do it.\n>\n> 3. Create a third project that will host your new work with extra\n> subtrees that you don't want.  Use 'git subtree add' and 'git subtree\n> merge' to keep this up to date with the stuff you extracted in step 2.\n> (Repeat steps 1-3 as necessary to keep your project up to date with\n> the svn project.)\n>\n> 4. When you want to merge your own changes back into svn, first\n> extract them from your own project (step 3) using 'git subtree split'.\n> Then merge those changes into the main project (step 1) using 'git\n> subtree merge'.  Then use git-svn to upload them to the main svn repo.\n>\n> You can save yourself some steps if you import the *entire* svn\n> project into your own project, rather than trying to trim it on\n> import.  That way you only have to split when going from #3 to #1, not\n> in the other direction, and you don't need repository #2.\n>\n> If all this sounds crazy, it probably is.  Maybe see if you can come\n> up with a way to avoid trying to do this altogether.\n>\n> Good luck... :)\n\nSounding scary. But if the above description of what I'm trying to  \nachieve helps in finding a simple way to work I'm all ears :)\n\nThanks.\n\n> Avery\n>\n> [1] http://github.com/apenwarr/git-subtree\n\nI'll check this out anyway. Thanks.\n\nwith regards,\n--\n\nLachlan Deck\n"},{"id":"126084","messageId":"32541b130910272220p59482397wef0d51b1adf1a5bd@mail.gmail.com","threadId":"21391","inReplyTo":"AC7B0CB1-1B14-4EAE-A6B6-D0845EACE626@gmail.com","subject":"Re: git svn branch tracking + ignore paths","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2009-10-28T05:20:32Z","receivedAt":"2009-10-28T05:20:32Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Tue, Oct 27, 2009 at 11:00 PM, Lachlan Deck <lachlan.deck@gmail.com> wrote:\n> :) Sure. Essentially a project that I'm contributing to has both maven poms\n> and ant/lib-based configs (with the ant ones as default for eclipse .project\n> etc files). I'd like to be able to import the projects with maven into\n> Eclipse to work on things but without committing back changes to eclipse\n> .project/.classpath/.settings/*.\n>\n> So I'm hoping for a fairly transparent process.\n\nSo which are the files you don't want to import from trunk?  It\ndoesn't sound like there are any... so it's getting simpler already.\n\nAlso, can you just simply not commit any changes to the other files?\nThat would be the easiest way to deal with committing back.  The other\noption (slightly messier) is to change them in a single commit, and\nuse git rebase to move that commit out of the way when you're about to\npush your changes back into svn.\n\nHave fun,\n\nAvery\n"},{"id":"126085","messageId":"19979334-07EB-48CA-8E62-4ECC5E1FA51C@gmail.com","threadId":"21391","inReplyTo":"32541b130910272220p59482397wef0d51b1adf1a5bd@mail.gmail.com","subject":"Re: git svn branch tracking + ignore paths","fromName":"Lachlan Deck","fromEmail":"lachlan.deck@gmail.com","sentAt":"2009-10-28T05:59:19Z","receivedAt":"2009-10-28T05:59:19Z","isPatch":false,"sender":{"key":"lachlan.deck@gmail.com","avatar":"https://gravatar.com/avatar/d889ccc1f4816ed537181f076603b79f23f4eb000375824ddfdbecb3df85411c?d=mp&s=160"},"body":"On 28/10/2009, at 4:20 PM, Avery Pennarun wrote:\n\n> On Tue, Oct 27, 2009 at 11:00 PM, Lachlan Deck  \n> <lachlan.deck@gmail.com> wrote:\n>> :) Sure. Essentially a project that I'm contributing to has both  \n>> maven poms\n>> and ant/lib-based configs (with the ant ones as default for  \n>> eclipse .project\n>> etc files). I'd like to be able to import the projects with maven  \n>> into\n>> Eclipse to work on things but without committing back changes to  \n>> eclipse\n>> .project/.classpath/.settings/*.\n>>\n>> So I'm hoping for a fairly transparent process.\n>\n> So which are the files you don't want to import from trunk?  It\n> doesn't sound like there are any... so it's getting simpler already.\n\nThere are. I've currently (as a workaround) done the following within  \nthe main branch:\nadd the following to .git/info/exclude\n.settings\ntarget\n.classpath\n.project\n\nThe last two of these has no effect of course because .project  \nand .classpath files already exist -- and thus are marked as modified.  \nSo I'm currently doing a git stash && git svn rebase && git svn  \ndcommit && git stash pop\n\n\nI'm also wanting to exclude 'lib' folders from trunk (as these are not  \nneeded).\n\n> Also, can you just simply not commit any changes to the other files?\n> That would be the easiest way to deal with committing back.\n\nThat's what I'm doing now I guess - but it means I can't share the  \nproject setups (specific for maven, for example) with anyone.\n\n> The other\n> option (slightly messier) is to change them in a single commit, and\n> use git rebase to move that commit out of the way when you're about to\n> push your changes back into svn.\n\nYeah that'd be a bit of a slippery slope.\n\nwith regards,\n--\n\nLachlan Deck\n"},{"id":"126156","messageId":"32541b130910280900p421e69b1nbcd8dcfa211521ac@mail.gmail.com","threadId":"21391","inReplyTo":"19979334-07EB-48CA-8E62-4ECC5E1FA51C@gmail.com","subject":"Re: git svn branch tracking + ignore paths","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2009-10-28T16:00:59Z","receivedAt":"2009-10-28T16:00:59Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Wed, Oct 28, 2009 at 1:59 AM, Lachlan Deck <lachlan.deck@gmail.com> wrote:\n> On 28/10/2009, at 4:20 PM, Avery Pennarun wrote:\n>> So which are the files you don't want to import from trunk?  It\n>> doesn't sound like there are any... so it's getting simpler already.\n>\n> There are. I've currently (as a workaround) done the following within the\n> main branch:\n> add the following to .git/info/exclude\n> .settings\n> target\n> .classpath\n> .project\n>\n> The last two of these has no effect of course because .project and\n> .classpath files already exist -- and thus are marked as modified. So I'm\n> currently doing a git stash && git svn rebase && git svn dcommit && git\n> stash pop\n>\n> I'm also wanting to exclude 'lib' folders from trunk (as these are not\n> needed).\n\nThe problem is that as your branch diverges from what you *actually*\nwant to commit, it becomes exponentially more complicated to figure\nout what you *do* want to commit.\n\nNote that if you're planning to share your git project with other\npeople anyway, then you have an additional problem: you're using git\nsvn rebase, which is almost useless for sharing with other people\n(other than through svn, of course), for the same reason any git\nrebase is.\n\nOne option you have is to maintain two branches:\n\n1. (git-svn) The git-svn trunk, which contains only stuff you want upstream\n\n2. (master) Your live branch, which contains everything from (1) plus\nyour local customizations.\n\nWhen you want to fetch from svn, you do this:\n\n  git checkout master\n  git svn fetch git-svn\n  git merge git-svn\n\nWhen you want to push to svn, you do this:\n\n  git checkout git-svn\n  git merge --squash --no-commit master\n    (now undo your local customizations)\n  git commit\n  git svn dcommit\n  git checkout master\n  git merge git-svn\n\nNote that master never gets rebased, only merged.  If you can write a\nsimple script for \"undo your local customizations\" - such as reverting\na particular commit, for example - then you can put the above in a\nshell script and it should work fine most of the time.\n\nGood luck.\n\nAvery\n"},{"id":"126227","messageId":"D9663C6B-AF5E-4267-9E31-F1584D912461@gmail.com","threadId":"21391","inReplyTo":"32541b130910280900p421e69b1nbcd8dcfa211521ac@mail.gmail.com","subject":"Re: git svn branch tracking + ignore paths","fromName":"Lachlan Deck","fromEmail":"lachlan.deck@gmail.com","sentAt":"2009-10-29T01:53:05Z","receivedAt":"2009-10-29T01:53:05Z","isPatch":false,"sender":{"key":"lachlan.deck@gmail.com","avatar":"https://gravatar.com/avatar/d889ccc1f4816ed537181f076603b79f23f4eb000375824ddfdbecb3df85411c?d=mp&s=160"},"body":"On 29/10/2009, at 3:00 AM, Avery Pennarun wrote:\n\n> On Wed, Oct 28, 2009 at 1:59 AM, Lachlan Deck  \n> <lachlan.deck@gmail.com> wrote:\n>> On 28/10/2009, at 4:20 PM, Avery Pennarun wrote:\n>>> So which are the files you don't want to import from trunk?  It\n>>> doesn't sound like there are any... so it's getting simpler already.\n>>\n>> There are. I've currently (as a workaround) done the following  \n>> within the\n>> main branch:\n>> add the following to .git/info/exclude\n>> .settings\n>> target\n>> .classpath\n>> .project\n>>\n>> The last two of these has no effect of course because .project and\n>> .classpath files already exist -- and thus are marked as modified.  \n>> So I'm\n>> currently doing a git stash && git svn rebase && git svn dcommit &&  \n>> git\n>> stash pop\n>>\n>> I'm also wanting to exclude 'lib' folders from trunk (as these are  \n>> not\n>> needed).\n>\n> The problem is that as your branch diverges from what you *actually*\n> want to commit, it becomes exponentially more complicated to figure\n> out what you *do* want to commit.\n\nSure.\n\n> Note that if you're planning to share your git project with other\n> people anyway, then you have an additional problem: you're using git\n> svn rebase, which is almost useless for sharing with other people\n> (other than through svn, of course), for the same reason any git\n> rebase is.\n>\n> One option you have is to maintain two branches:\n>\n> 1. (git-svn) The git-svn trunk, which contains only stuff you want  \n> upstream\n>\n> 2. (master) Your live branch, which contains everything from (1) plus\n> your local customizations.\n>\n> When you want to fetch from svn, you do this:\n>\n>  git checkout master\n>  git svn fetch git-svn\n>  git merge git-svn\n>\n> When you want to push to svn, you do this:\n>\n>  git checkout git-svn\n>  git merge --squash --no-commit master\n>    (now undo your local customizations)\n>  git commit\n>  git svn dcommit\n>  git checkout master\n>  git merge git-svn\n>\n> Note that master never gets rebased, only merged.  If you can write a\n> simple script for \"undo your local customizations\" - such as reverting\n> a particular commit, for example - then you can put the above in a\n> shell script and it should work fine most of the time.\n\nThanks Avery!\n  - that gives me something to think about.\n\nwith regards,\n--\n\nLachlan Deck\n"}]}