{"thread":{"id":"20858","subject":"Use case I don't know how to address","startedAt":"2009-09-05T07:02:04Z","lastAt":"2009-09-07T12:08:05Z","messageCount":7,"participants":["Alan Chandler","Johannes Sixt","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"122487","messageId":"4AA20CEC.8060408@chandlerfamily.org.uk","threadId":"20858","inReplyTo":null,"subject":"Use case I don't know how to address","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2009-09-05T07:02:04Z","receivedAt":"2009-09-05T07:02:04Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"I have a use case that I don't know how to address.  I have a feeling \nthat the way I propose is not using git to its best advantage, and am \ntherefore asking for advice.\n\nAs an intermittent software developer I have been using git for a long \ntime to track software (GPL licenced) I have developed for a web site \nthat I operate supporting a fan club. [Ajax based Chat, a real time Air \nHockey Game with associated club Ladder, and an American Football \nResults Picking Competition]\n\nEach application uses a pattern like that shown below\n\nBasically I have two branches that interact as follows\n\n        2' - 2a - 3' - 4'  SITE\n       /         /    /\n1 -  2  ------ 3  - 4  MASTER\n\nI develop and test Locally on the master branch, in the commit 2a I \nupdate settings (such as database password etc that I need for the \nsite), and then progressively merge commits made on master when I am \nhappy that they work in the test environment.  A git hook rsyncs the \nsite branch to site on each merge or commit on that branch.\n\nThe master branch is also pushed to my public git repository (which is \nwhy passwords are changed on the site branch.  The change made back in \n2a is \"remembered\" by git, so provided I don't go editing the password \non the master branch things work fine.\n\nMy applications tend to be \"skinned\" (if that is the right word for the \nhtml page that forms the backdrop for them) with the fan club web site \nlook and feel.  However, I am now trying to make a demo site on my home \nserver for these applications, and as such I would like to remove the \nfan club skinning and add my own look and feel.  In fact there are other \nchanges necessary, because many of the applications use the associated \nfan club membership information of the user to display - so generically, \nI need to make quite a lot of modifications to make it all work and \nwould end up with 4 branches as shown, with the difference in commits \nbetween 4 and 5 as that major work to update the application.\n\n\n        2' - 2a - 3' - 4'  SITE\n       /         /    /\n1 -  2  ------ 3  - 4  TEST\n                      \\\n                        5  ------ 6  MASTER\n                         \\         \\\n                           5' - 5a- 6' DEMO\n\n\nAs you can see, in the process I have renamed Master to Test - the \ntransition to 5a adds passwords to access the database on my demo site.\n\nThe problem comes when I want to now merge back further work that I did \non the master branch (the 5-6 transition) to the fan club site\n\n\n        2' - 2a - 3' - 4' ----------------- 6' SITE\n       /         /    /                    /\n1 -  2  ------ 3  - 4  ------------6'''- 6a TEST\n                      \\            /\n                        5  ------ 6  MASTER\n                         \\         \\\n                           5''- 5a- 6'' DEMO\n\n\nWhat will happen is the changes made in 4->5 will get applied to the \n(now) Test branch as part of the 6->6'' merge, and I will be left having \nto add a new commit, 6a, to undo them all again.  Given this is likely \nto be quite a substantial change I want to try and avoid it if possible.\n\nIs there any way I could use git to remember the 4->5 transition, \nreverse it and apply it back to the Test branch before hand.\n\n\n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\n"},{"id":"122523","messageId":"200909051923.28831.j6t@kdbg.org","threadId":"20858","inReplyTo":"4AA20CEC.8060408@chandlerfamily.org.uk","subject":"Re: Use case I don't know how to address","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2009-09-05T17:23:28Z","receivedAt":"2009-09-05T17:23:28Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Samstag, 5. September 2009, Alan Chandler wrote:\n> The problem comes when I want to now merge back further work that I did\n> on the master branch (the 5-6 transition) to the fan club site\n>\n>\n>         2' - 2a - 3' - 4' ----------------- 6' SITE\n>        /         /    /                    /\n> 1 -  2  ------ 3  - 4  ------------6'''- 6a TEST\n>                       \\            /\n>                         5  ------ 6  MASTER\n>                          \\         \\\n>                            5''- 5a- 6'' DEMO\n>\n>\n> What will happen is the changes made in 4->5 will get applied to the\n> (now) Test branch as part of the 6->6'' merge, and I will be left having\n> to add a new commit, 6a, to undo them all again.  Given this is likely\n> to be quite a substantial change I want to try and avoid it if possible.\n>\n> Is there any way I could use git to remember the 4->5 transition,\n> reverse it and apply it back to the Test branch before hand.\n\nBasically, your mistake was to rename master to test and continue development \non the demo branch. So what you should do instead is this:\n\n        2' - 2a - 3' - 4' ------ 6' SITE\n       /         /    /         /\n1 -  2  ------ 3  - 4  ------- 6  MASTER\n                      \\         \\\n                        5 - 5a - 6'' DEMO\n\nIOW, you keep developing on master, and merge that into the two deployment \nbranches.\n\nIn practice, it may be easier to develop commit 6 on DEMO (because you can \ndebug it more easily, or for similar reasons), but then you should rebase it \nback to MASTER, reset DEMO back to 5a, and finally merge MASTER into DEMO.\n\n-- Hannes\n"},{"id":"122546","messageId":"7vk50ccxfj.fsf@alter.siamese.dyndns.org","threadId":"20858","inReplyTo":"4AA20CEC.8060408@chandlerfamily.org.uk","subject":"Re: Use case I don't know how to address","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-09-06T08:03:12Z","receivedAt":"2009-09-06T08:03:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alan Chandler <alan@chandlerfamily.org.uk> writes:\n\n>        2' - 2a - 3' - 4' ----------------- 6' SITE\n>       /         /    /                    /\n> 1 -  2  ------ 3  - 4  ------------6'''- 6a TEST\n>                      \\            /\n>                        5  ------ 6  MASTER\n>                         \\         \\\n>                           5''- 5a- 6'' DEMO\n>\n>\n> What will happen is the changes made in 4->5 will get applied to the\n> (now) Test branch as part of the 6->6'' merge, and I will be left\n> having to add a new commit, 6a, to undo them all again.  Given this is\n> likely to be quite a substantial change I want to try and avoid it if\n> possible.\n\nI presume 6'''-6a has the revert of 4-5?  If so, the next merge should\nwork just fine.\n\nYou have arranged TEST->SITE transition correctly to limiting the SITE\ncustomization to 2a and never merging SITE back to TEST, so we can ignore\nSITE branch altogether from now on.  Similarly we can ignore DEMO branch,\nsince its customization is limited to 5a and it never gets merged back to\nMASTER.\n\n    1 -  2  ------ 3  - 4  ------------6'''- 6a-----7a??? TEST\n                         \\            /            /    \n                           5  ------ 6------------7 MASTER\n\nNow, 6-7 is a new feature built on MASTER.  What would happen when it is\nmerged to TEST to produce 7a?\n\nThe merge base for this merge is 6, and since that commit to the tip of\nthe TEST branch 6a, there is a \"skin from vanilla to FanClub\" change and\nnothing else.  On the other hand, since the merge base to the tip of the\nMASTER branch 7, there is a \"feature enhancement\" but no skin related\nchanges.\n\nSo bog-standard three-way merge should say:\n\n - One branch, MASTER, added these features, but TEST branch did not do\n   anything with these feature changes since the merge base.  We'll use\n   the feature change done on MASTER.\n\n - The other branch, TEST, changed the skin from the merge base, but\n   MASTER branch did not change any skinning.  We'll keep the skin change\n   done on TEST.\n\nAnd everything should be fine.\n"},{"id":"122577","messageId":"4AA3AEA1.7030107@chandlerfamily.org.uk","threadId":"20858","inReplyTo":"7vk50ccxfj.fsf@alter.siamese.dyndns.org","subject":"Re: Use case I don't know how to address","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2009-09-06T12:44:17Z","receivedAt":"2009-09-06T12:44:17Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> Alan Chandler <alan@chandlerfamily.org.uk> writes:\n> \n>>        2' - 2a - 3' - 4' ----------------- 6' SITE\n>>       /         /    /                    /\n>> 1 -  2  ------ 3  - 4  ------------6'''- 6a TEST\n>>                      \\            /\n>>                        5  ------ 6  MASTER\n>>                         \\         \\\n>>                           5''- 5a- 6'' DEMO\n>>\n>>\n>> What will happen is the changes made in 4->5 will get applied to the\n>> (now) Test branch as part of the 6->6'' merge, and I will be left\n>> having to add a new commit, 6a, to undo them all again.  Given this is\n>> likely to be quite a substantial change I want to try and avoid it if\n>> possible.\n> \n> I presume 6'''-6a has the revert of 4-5?  If so, the next merge should\n> work just fine.\n\n\nI think you missed the issue - Yes 6'''-6a is the revert, but the \nproblem is this could be large and complicated, and I wanted to find an \nautomated way rather than manual\n\nSort of like doing a diff of 4-5 and somehow applying it backwards.\n\n\n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\n"},{"id":"122554","messageId":"4AA3B01A.7060005@chandlerfamily.org.uk","threadId":"20858","inReplyTo":"200909051923.28831.j6t@kdbg.org","subject":"Re: Use case I don't know how to address","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2009-09-06T12:50:34Z","receivedAt":"2009-09-06T12:50:34Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"Johannes Sixt wrote:\n> On Samstag, 5. September 2009, Alan Chandler wrote:\n>> The problem comes when I want to now merge back further work that I did\n>> on the master branch (the 5-6 transition) to the fan club site\n>>\n>>\n>>         2' - 2a - 3' - 4' ----------------- 6' SITE\n>>        /         /    /                    /\n>> 1 -  2  ------ 3  - 4  ------------6'''- 6a TEST\n>>                       \\            /\n>>                         5  ------ 6  MASTER\n>>                          \\         \\\n>>                            5''- 5a- 6'' DEMO\n>>\n>>\n>> What will happen is the changes made in 4->5 will get applied to the\n>> (now) Test branch as part of the 6->6'' merge, and I will be left having\n>> to add a new commit, 6a, to undo them all again.  Given this is likely\n>> to be quite a substantial change I want to try and avoid it if possible.\n>>\n>> Is there any way I could use git to remember the 4->5 transition,\n>> reverse it and apply it back to the Test branch before hand.\n> \n> Basically, your mistake was to rename master to test and continue development \n> on the demo branch. So what you should do instead is this:\n> \n>         2' - 2a - 3' - 4' ------ 6' SITE\n>        /         /    /         /\n> 1 -  2  ------ 3  - 4  ------- 6  MASTER\n>                       \\         \\\n>                         5 - 5a - 6'' DEMO\n> \n\n\nI understand what you are saying.  I think I need to consider a slight \nchange to it however.  Master is currently the branch that I push to my \npublic repository and that should ideally have my NON FAN CLUB skinning\n\nSo actually I think I am like this\n\n          2' - 2a - 3' - 4' ------ 6' SITE\n         /         /    /         /\n  1 -  2  ------ 3  - 4  ------- 6  MASTER\n                        \\         \\\n                          5 - -- - 6'' PUBLIC REPO\n                           \\        \\\n                            5'''-5a -6''' DEMO\n\n\n\n\n\n\n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\n"},{"id":"122615","messageId":"4AA4F632.3070206@chandlerfamily.org.uk","threadId":"20858","inReplyTo":"4AA3AEA1.7030107@chandlerfamily.org.uk","subject":"Re: Use case I don't know how to address","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2009-09-07T12:01:54Z","receivedAt":"2009-09-07T12:01:54Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"Alan Chandler wrote:\n> Junio C Hamano wrote:\n>> Alan Chandler <alan@chandlerfamily.org.uk> writes:\n>>\n>>>        2' - 2a - 3' - 4' ----------------- 6' SITE\n>>>       /         /    /                    /\n>>> 1 -  2  ------ 3  - 4  ------------6'''- 6a TEST\n>>>                      \\            /\n>>>                        5  ------ 6  MASTER\n>>>                         \\         \\\n>>>                           5''- 5a- 6'' DEMO\n>>>\n>>>\n>>> What will happen is the changes made in 4->5 will get applied to the\n>>> (now) Test branch as part of the 6->6'' merge, and I will be left\n>>> having to add a new commit, 6a, to undo them all again.  Given this is\n>>> likely to be quite a substantial change I want to try and avoid it if\n>>> possible.\n>>\n>> I presume 6'''-6a has the revert of 4-5?  If so, the next merge should\n>> work just fine.\n> \n> \n> I think you missed the issue - Yes 6'''-6a is the revert, but the \n> problem is this could be large and complicated, and I wanted to find an \n> automated way rather than manual\n> \n> Sort of like doing a diff of 4-5 and somehow applying it backwards.\n> \n> \n\nI just discovered that git-apply has the -R flag.  Is that what I am \nlooking for?\n\n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\n"},{"id":"122616","messageId":"4AA4F7A5.2060904@chandlerfamily.org.uk","threadId":"20858","inReplyTo":"4AA4F632.3070206@chandlerfamily.org.uk","subject":"Re: Use case I don't know how to address","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2009-09-07T12:08:05Z","receivedAt":"2009-09-07T12:08:05Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"Alan Chandler wrote:\n> Alan Chandler wrote:\n>> Junio C Hamano wrote:\n>>> Alan Chandler <alan@chandlerfamily.org.uk> writes:\n>>>\n>>>>        2' - 2a - 3' - 4' ----------------- 6' SITE\n>>>>       /         /    /                    /\n>>>> 1 -  2  ------ 3  - 4  ------------6'''- 6a TEST\n>>>>                      \\            /\n>>>>                        5  ------ 6  MASTER\n>>>>                         \\         \\\n>>>>                           5''- 5a- 6'' DEMO\n>>>>\n>>>>\n>>>> What will happen is the changes made in 4->5 will get applied to the\n>>>> (now) Test branch as part of the 6->6'' merge, and I will be left\n>>>> having to add a new commit, 6a, to undo them all again.  Given this is\n>>>> likely to be quite a substantial change I want to try and avoid it if\n>>>> possible.\n>>>\n>>> I presume 6'''-6a has the revert of 4-5?  If so, the next merge should\n>>> work just fine.\n>>\n>>\n>> I think you missed the issue - Yes 6'''-6a is the revert, but the \n>> problem is this could be large and complicated, and I wanted to find \n>> an automated way rather than manual\n>>\n>> Sort of like doing a diff of 4-5 and somehow applying it backwards.\n>>\n>>\n> \n> I just discovered that git-apply has the -R flag.  Is that what I am \n> looking for?\n> \n\n         2' - 2a - 3' - 4' ------------ 6' SITE\n        /         /    /               /\n  1 -  2  ------ 3  - 4  --5'''--5b---6''' TEST\n                       \\  /          /\n                         5  ------ 6  MASTER\n                          \\         \\\n                           5''- 5a- 6'' DEMO\n\n\nJust to be clear - if I do a diff of 4->5 and then immediately merge it \nback to 4 as 5'' (which fast forwards 4) and then 5b is the diff of 4-5 \napplied with git apply -R.\n\nIs that what the -R flag does on git apply?\n\n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\n"}]}