{"thread":{"id":"21638","subject":"Advice/help needed","startedAt":"2009-11-16T16:27:35Z","lastAt":"2009-11-16T22:46:57Z","messageCount":3,"participants":["Ian Hobson","Yann Simon"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"127688","messageId":"4B017D77.6060505@ianhobson.co.uk","threadId":"21638","inReplyTo":null,"subject":"Advice/help needed","fromName":"Ian Hobson","fromEmail":"ian@ianhobson.co.uk","sentAt":"2009-11-16T16:27:35Z","receivedAt":"2009-11-16T16:27:35Z","isPatch":false,"sender":{"key":"ian@ianhobson.co.uk","avatar":null},"body":"Hi all,\n\nI am trying to switch to GIT (from SVN), and have become sorely \nconfused. I am not sure of the best way to solve the problem I have, \n(nor how to actually implement a solution when one is chosen).\n\nI am building a web application in php. There are  2 (soon to be four) \nversions each slightly different for different customers. Each needs \ntesting when installed in \"/\" and \"/dir\" on the web site.\n\nSo far I have one system that in installed in a git repo on a Linux VM \nwith a share. This way I can develop in windows where I am familiar, \nserve the files under linux (to match the production environment) and \nrun unit tests using phpUnit. The test files are all in a sub-directory \nof the main directory. The application is served from a directory in the \nwebsite, so I could have different directories for different purposes, \nbut I have not had to use this yet.\n\nBefore release, I fetch and merge the files into a second installation \nunder windows, where I can serve it from the root. This forms a second \nlevel of test. I release by copying the files with FTP (so that test \nfiles and the GIT repo don't go on the production server).\n\nThis arrangement only works because I have been able to set up the \nconfiguration files, database users and similar so they are all the same \non each installation. With 4 similar versions this will no longer be \npossible.\n\nWhat I want to be able to do is control all 4 versions in the same \nmanner, keep all file - common, different and test - in git, and have \ncheckout worry about changing versions.\n\nMy thoughts are to have 4 branches, one for each customer. 99% of all \nchanges will be needed by all (or at least most)\nof the customers (P,W,S and E). How can I make a change to master and \nthen use git to apply those changes to the four branches, without losing \nthe differences between branches?\n\nFor example (if this is the best way) go from this\nO-----O-----A-----B-----C  (master)\n  \\----P\n   \\---W\n    \\--S\n     \\-E\n\nto first this, where D is the net effect of A B and C  (this is for ease \nof reading logs, and commit messages),\nO-----O-----D  (head) \n  \\----P\n   \\---W\n    \\--S\n     \\-E\n\nand then to this, (without editing all the files four times?)\nO-----O-----D  (head)\n  \\----P-----D'\n   \\---W----D''\n    \\--S-----D'''\n     \\-E-----D''''\n\nOr would I be better having 4 repositories, one for each customer? Then \nI need to pull changes and cherry pick the changes I want for each \ncustomer?\n\nI am the only developer, so the processes need to be simple so I am not \nfaced with sorting out my own errors! :)\n\nRegards\n\nIan\n"},{"id":"127689","messageId":"551f769b0911160840k6ea274e9q33de777fac7cec70@mail.gmail.com","threadId":"21638","inReplyTo":"4B017D77.6060505@ianhobson.co.uk","subject":"Re: Advice/help needed","fromName":"Yann Simon","fromEmail":"yann.simon.fr@gmail.com","sentAt":"2009-11-16T16:40:10Z","receivedAt":"2009-11-16T16:40:10Z","isPatch":false,"sender":{"key":"yann.simon.fr@gmail.com","avatar":"https://gravatar.com/avatar/2d926895d27ac988c5c8e591887e5a6a4c7036390403c74fce92519119b887a0?d=mp&s=160"},"body":"2009/11/16 Ian Hobson <ian@ianhobson.co.uk>:\n> My thoughts are to have 4 branches, one for each customer. 99% of all\n> changes will be needed by all (or at least most)\n> of the customers (P,W,S and E). How can I make a change to master and then\n> use git to apply those changes to the four branches, without losing the\n> differences between branches?\n>\n> For example (if this is the best way) go from this\n> O-----O-----A-----B-----C  (master)\n>  \\----P\n>  \\---W\n>   \\--S\n>    \\-E\n>\n> to first this, where D is the net effect of A B and C  (this is for ease of\n> reading logs, and commit messages),\n> O-----O-----D  (head)  \\----P\n>  \\---W\n>   \\--S\n>    \\-E\n>\n> and then to this, (without editing all the files four times?)\n> O-----O-----D  (head)\n>  \\----P-----D'\n>  \\---W----D''\n>   \\--S-----D'''\n>    \\-E-----D''''\n\nWhat I would do is:\n- one branch for the common\n- one branch for each customer, which contains the specific\ndifferences compare to the common branch\n\nYou could program on the common branch.\nWhen you are ready, you can checkout each specific branch and rebase\non the common branch.\nFor example:\n$ git checkout common\nedit, test, commit\n$ git checkout client1\n$ git rebase common\n$ git checkout client2\n$ git rebase common\n\nAnother solution is to have a branch for each customer, to commit on\none branch, and to cherry-pick this last commit on all the other\nbranches.\n\nYann\n"},{"id":"127704","messageId":"4B01D661.2060401@ianhobson.co.uk","threadId":"21638","inReplyTo":"551f769b0911160840k6ea274e9q33de777fac7cec70@mail.gmail.com","subject":"Re: Advice/help needed","fromName":"Ian Hobson","fromEmail":"ian@ianhobson.co.uk","sentAt":"2009-11-16T22:46:57Z","receivedAt":"2009-11-16T22:46:57Z","isPatch":false,"sender":{"key":"ian@ianhobson.co.uk","avatar":null},"body":"Yann Simon wrote:\n> 2009/11/16 Ian Hobson <ian@ianhobson.co.uk>:\n>   \n>> My thoughts are to have 4 branches, one for each customer. 99% of all\n>> changes will be needed by all (or at least most)\n>> of the customers (P,W,S and E). How can I make a change to master and then\n>> use git to apply those changes to the four branches, without losing the\n>> differences between branches?\n>>\n>> For example (if this is the best way) go from this\n>> O-----O-----A-----B-----C  (master)\n>>  \\----P\n>>  \\---W\n>>   \\--S\n>>    \\-E\n>>\n>> to first this, where D is the net effect of A B and C  (this is for ease of\n>> reading logs, and commit messages),\n>> O-----O-----D  (head)  \\----P\n>>  \\---W\n>>   \\--S\n>>    \\-E\n>>\n>> and then to this, (without editing all the files four times?)\n>> O-----O-----D  (head)\n>>  \\----P-----D'\n>>  \\---W----D''\n>>   \\--S-----D'''\n>>    \\-E-----D''''\n>>     \n>\n> What I would do is:\n> - one branch for the common\n> - one branch for each customer, which contains the specific\n> differences compare to the common branch\n>\n> You could program on the common branch.\n> When you are ready, you can checkout each specific branch and rebase\n> on the common branch.\n> For example:\n> $ git checkout common\n> edit, test, commit\n> $ git checkout client1\n> $ git rebase common\n> $ git checkout client2\n> $ git rebase common\n>\n>   \nHi Yann,\n\nI'll use master for common, unless I have a large chunk of development \nto do, and see how it goes.\n\nMany thanks.\n\nIan\n"}]}