{"thread":{"id":"25875","subject":"Merging (only) subdirectories","startedAt":"2010-12-01T11:18:10Z","lastAt":"2010-12-03T20:38:24Z","messageCount":9,"participants":["Howard Miller","Martin Krüger","Nguyen Thai Ngoc Duy","Enrico Weigelt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"156908","messageId":"AANLkTimZc0r8WBOsE73V=7SKdZgONiCKfYCk7rBrCY3F@mail.gmail.com","threadId":"25875","inReplyTo":null,"subject":"Merging (only) subdirectories","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2010-12-01T11:18:10Z","receivedAt":"2010-12-01T11:18:10Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"This might take a bit of explaining... and for those familiar with it\nI'm talking about Moodle themes which will help one or two of you.\n\nWe develop themes for Moodle. All themes live in their own\nself-contained directory. So, when creating a new theme we create a\nnew branch (from some version of Moodle - more in a moment) then a new\ntheme folder, do the dev, and commit/push the results.\n\nWe have lots of clients and for one reason or another we have lots of\ndifferent versions of Moodle and/or different customisations. So each\nclient ends up with their own branch.\n\nThe problem comes when Client A wants to purchase Theme B. We can't\njust merge the theme branch because all the rest of the project\ncontains (potentially) a different version of Moodle. So we have to do\nlots of messing around to get the theme branch in and/or loose the\ntheme commit history in the process.\n\nWhat I would like to do is to be able to merge branch B into branch A\nbut ONLY stuff that concerns the theme directory. I don't think this\nis possible. I'm reluctant to keep themes in a completely separate\nrepo as that just makes testing them more problematic.\n\nDoes anybody have any thoughts or advice (assuming this all makes\nsense)?  Cheers!\n"},{"id":"156910","messageId":"20101201114759.136280@gmx.net","threadId":"25875","inReplyTo":"AANLkTimZc0r8WBOsE73V=7SKdZgONiCKfYCk7rBrCY3F@mail.gmail.com","subject":"Re: Merging (only) subdirectories","fromName":"Martin Krüger","fromEmail":"martin.krueger@gmx.com","sentAt":"2010-12-01T11:47:59Z","receivedAt":"2010-12-01T11:47:59Z","isPatch":false,"sender":{"key":"martin.krueger@gmx.com","avatar":null},"body":"\n> \n> The problem comes when Client A wants to purchase Theme B. We can't\n> just merge the theme branch because all the rest of the project\n> contains (potentially) a different version of Moodle. So we have to do\n> lots of messing around to get the theme branch in and/or loose the\n> theme commit history in the process.\n> \nI would say you are not working best practice with git. The idea of commit is a atomic  change of the whole project.  It seems like you mixed completely unrelated changes in a commit.\n\nYou can try as a resolution:\ngit rebase master  (on a temporary-branch)\ngit format-patch master\n\nStrip the patches with filterdiff\n\nApply the stripped patches to another temporary-brach.\nMerge to the target-Branch.\n\nBest regards\n     martin\n"},{"id":"156911","messageId":"AANLkTiki=BAZJ+xhDZaaOkfejJdvj4zeLRpyHbJ-cu8b@mail.gmail.com","threadId":"25875","inReplyTo":"20101201114759.136280@gmx.net","subject":"Re: Merging (only) subdirectories","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2010-12-01T11:56:55Z","receivedAt":"2010-12-01T11:56:55Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"2010/12/1 \"Martin Krüger\" <martin.krueger@gmx.com>:\n\n>>\n> I would say you are not working best practice with git. The idea of commit is a atomic  change of the whole project.  It seems like you mixed completely unrelated changes in a commit.\n>\n> You can try as a resolution:\n> git rebase master  (on a temporary-branch)\n> git format-patch master\n>\n> Strip the patches with filterdiff\n>\n> Apply the stripped patches to another temporary-brach.\n> Merge to the target-Branch.\n>\n> Best regards\n>     martin\n\nthanks Martin,\n\nThere's a whole bunch of stuff there that I am not familiar with so I\nneed to do some reading!  When you say we are not using best practices\ncan you elaborate? I am very open to improving the way we do things.\n\nHoward\n"},{"id":"156912","messageId":"AANLkTikviz82b_CL=cwfQgxWFXQbxEPOPpOHOGadbV3A@mail.gmail.com","threadId":"25875","inReplyTo":"20101201114759.136280@gmx.net","subject":"Re: Merging (only) subdirectories","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2010-12-01T11:59:54Z","receivedAt":"2010-12-01T11:59:54Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"2010/12/1 \"Martin Krüger\" <martin.krueger@gmx.com>:\n>\n\n>>\n> I would say you are not working best practice with git. The idea of commit is a atomic  change of the whole project.  It seems like you mixed completely unrelated changes in a commit.\n>\n\n> Best regards\n>     martin\n>\n\nActually... thinking some more... that was actually my question (sorry\nif I wasn't clear). We know that we are probably not doing this the\nbest way but we can't work out the right/better way. I'm looking for\nhelp to organise our workflow with git better,\n\nThanks :)\n"},{"id":"156913","messageId":"AANLkTik-d8oys9h=wFRnyt8sukTsSymaw5LGM39BU2K=@mail.gmail.com","threadId":"25875","inReplyTo":"AANLkTimZc0r8WBOsE73V=7SKdZgONiCKfYCk7rBrCY3F@mail.gmail.com","subject":"Re: Merging (only) subdirectories","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-12-01T12:36:22Z","receivedAt":"2010-12-01T12:36:22Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Wed, Dec 1, 2010 at 6:18 PM, Howard Miller\n<howard@e-learndesign.co.uk> wrote:\n> What I would like to do is to be able to merge branch B into branch A\n> but ONLY stuff that concerns the theme directory. I don't think this\n> is possible. I'm reluctant to keep themes in a completely separate\n> repo as that just makes testing them more problematic.\n\nI don't know. Maybe you can use topic branch. The idea is that you and\nother theme designers branch out from a known point, then make changes\nin the theme directory only. You guys can merge from each other's tree\nbecause nobody would change anything outside theme directory.\nOccasionally you can merge back upstream for testing with new code,\nbut don't push that merge until your theme is ready. Once your theme\nrolls out, you can either keep working on your topic branch, or throw\nit away and branch out again.\n\nAlso, please consider submodules if theme dir is totally independent.\nI don't see how it makes it problematic for testing. git-subtree [1]\nmight be of your interest too.\n\n[1] https://github.com/apenwarr/git-subtree\n-- \nDuy\n"},{"id":"156916","messageId":"AANLkTi=gDdasJ1gsAgSCxQ5a3pWvTNCfiaSn5h-WUt1C@mail.gmail.com","threadId":"25875","inReplyTo":"AANLkTik-d8oys9h=wFRnyt8sukTsSymaw5LGM39BU2K=@mail.gmail.com","subject":"Re: Merging (only) subdirectories","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2010-12-01T12:55:55Z","receivedAt":"2010-12-01T12:55:55Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"On 1 December 2010 12:36, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n> On Wed, Dec 1, 2010 at 6:18 PM, Howard Miller\n> <howard@e-learndesign.co.uk> wrote:\n>> What I would like to do is to be able to merge branch B into branch A\n>> but ONLY stuff that concerns the theme directory. I don't think this\n>> is possible. I'm reluctant to keep themes in a completely separate\n>> repo as that just makes testing them more problematic.\n>\n> I don't know. Maybe you can use topic branch. The idea is that you and\n> other theme designers branch out from a known point, then make changes\n> in the theme directory only. You guys can merge from each other's tree\n> because nobody would change anything outside theme directory.\n> Occasionally you can merge back upstream for testing with new code,\n> but don't push that merge until your theme is ready. Once your theme\n> rolls out, you can either keep working on your topic branch, or throw\n> it away and branch out again.\n>\n> Also, please consider submodules if theme dir is totally independent.\n> I don't see how it makes it problematic for testing. git-subtree [1]\n> might be of your interest too.\n>\n> [1] https://github.com/apenwarr/git-subtree\n> --\n> Duy\n>\n\nThanks! Again, I need to go and do some reading to see if those things\nfit my needs.\n"},{"id":"157197","messageId":"20101203105957.GA14783@nibiru.local","threadId":"25875","inReplyTo":"AANLkTik-d8oys9h=wFRnyt8sukTsSymaw5LGM39BU2K=@mail.gmail.com","subject":"Re: Merging (only) subdirectories","fromName":"Enrico Weigelt","fromEmail":"weigelt@metux.de","sentAt":"2010-12-03T10:59:58Z","receivedAt":"2010-12-03T10:59:58Z","isPatch":false,"sender":{"key":"weigelt@metux.de","avatar":null},"body":"* Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n\n> Also, please consider submodules if theme dir is totally independent.\n> I don't see how it makes it problematic for testing. git-subtree [1]\n> might be of your interest too.\n> \n> [1] https://github.com/apenwarr/git-subtree\n\nAnother option could be completely splitting off the themes to\ntheir own branches (eg. using git-filter-branch), check them\nout in an separate workdir and use unionfs to get a combined/merged\nview of the working trees.\n\nSo, you'd actually have to fully separate branches, checked out\nin their own worktrees/repos:\n\na) mainapp (the main application)\nb) theme (the current theme you're working on)\n\nFor testing/runtime, the webserver gets a union'ed tree,\nwhich just merges both namespaces (from host filesystems's, not\ngit's view) together. Your actual development happens in the theme\nrepo only.\n\n\nOn actual deployment (if you're using git here, too), you can simply\nmerge both branches together (will be just an passive - aka: \nmerge-down-only - branch).\n\n\ncu\n-- \n----------------------------------------------------------------------\n Enrico Weigelt, metux IT service -- http://www.metux.de/\n\n phone:  +49 36207 519931  email: weigelt@metux.de\n mobile: +49 151 27565287  icq:   210169427         skype: nekrad666\n----------------------------------------------------------------------\n Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme\n----------------------------------------------------------------------\n"},{"id":"157198","messageId":"AANLkTina5UwRZVGOVdnAJe0U2B_rCiGhoOdSArw6ZQd+@mail.gmail.com","threadId":"25875","inReplyTo":"20101203105957.GA14783@nibiru.local","subject":"Re: Merging (only) subdirectories","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2010-12-03T11:12:47Z","receivedAt":"2010-12-03T11:12:47Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"> Another option could be completely splitting off the themes to\n> their own branches (eg. using git-filter-branch), check them\n> out in an separate workdir and use unionfs to get a combined/merged\n> view of the working trees.\n>\n> So, you'd actually have to fully separate branches, checked out\n> in their own worktrees/repos:\n>\n> a) mainapp (the main application)\n> b) theme (the current theme you're working on)\n>\n> For testing/runtime, the webserver gets a union'ed tree,\n> which just merges both namespaces (from host filesystems's, not\n> git's view) together. Your actual development happens in the theme\n> repo only.\n>\n>\n> On actual deployment (if you're using git here, too), you can simply\n> merge both branches together (will be just an passive - aka:\n> merge-down-only - branch).\n\nOk... thanks for that. I'll have a look at that as well.\n\nThis type of thing was actually the one thing I can think of that\ncvs/svn made easy as they keep the repo info in each directory :)  (Do\nI get thrown out for saying that?)\n"},{"id":"157256","messageId":"20101203203824.GA14508@nibiru.local","threadId":"25875","inReplyTo":"AANLkTina5UwRZVGOVdnAJe0U2B_rCiGhoOdSArw6ZQd+@mail.gmail.com","subject":"Re: Merging (only) subdirectories","fromName":"Enrico Weigelt","fromEmail":"weigelt@metux.de","sentAt":"2010-12-03T20:38:24Z","receivedAt":"2010-12-03T20:38:24Z","isPatch":false,"sender":{"key":"weigelt@metux.de","avatar":null},"body":"* Howard Miller <howard@e-learndesign.co.uk> wrote:\n\n> This type of thing was actually the one thing I can think of that\n> cvs/svn made easy as they keep the repo info in each directory :)  \n\nBesides the fact that their underlying data model makes things\nlike merging particularily hard (svn initially had no branch\nconcept at all ;-o).\n\nBTW: M$-TFS combines the worst of all ...\n\n\ncu\n-- \n----------------------------------------------------------------------\n Enrico Weigelt, metux IT service -- http://www.metux.de/\n\n phone:  +49 36207 519931  email: weigelt@metux.de\n mobile: +49 151 27565287  icq:   210169427         skype: nekrad666\n----------------------------------------------------------------------\n Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme\n----------------------------------------------------------------------\n"}]}