{"thread":{"id":"21210","subject":"Merge (or maybe rebase) question","startedAt":"2009-10-12T11:55:37Z","lastAt":"2009-10-12T18:13:12Z","messageCount":2,"participants":["Howard Miller","Alex Riesen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"124687","messageId":"26ae428a0910120455k7ab5aa5ag8d701050e7acec5f@mail.gmail.com","threadId":"21210","inReplyTo":null,"subject":"Merge (or maybe rebase) question","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2009-10-12T11:55:37Z","receivedAt":"2009-10-12T11:55:37Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"Another how best to do this.\n\n- I have my project all nicely in git with all the different releases\nand versions in there going back years. Happy :-)\n\n- I have a customer who has heaviliy modified an oldish version of the\nsoftware.\n\n- I have identified the version that they modified and created a\nbranch in my git repo based on that version (i.e. what they would have\nstarted with before modifying it)\n\n- Their changes where applied to a simple download - no version\ncontrol, no nothing.\n\nI now need to update them to the latest version of the software - can\ngit help me here or is it all a disaster?\n\nAs usual, any advice much appreciated.\n\nPS. To make matters worse - their original is full of expanced CVS\n$Id:$ tags so it will look to git like every single file has changed.\nDamn you cvs!!!\n"},{"id":"124723","messageId":"81b0412b0910121113l7d084618o6d34fb4a0389421c@mail.gmail.com","threadId":"21210","inReplyTo":"26ae428a0910120455k7ab5aa5ag8d701050e7acec5f@mail.gmail.com","subject":"Re: Merge (or maybe rebase) question","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2009-10-12T18:13:12Z","receivedAt":"2009-10-12T18:13:12Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On Mon, Oct 12, 2009 at 13:55, Howard Miller <howard@e-learndesign.co.uk> wrote:\n> Another how best to do this.\n>\n> - I have my project all nicely in git with all the different releases\n> and versions in there going back years. Happy :-)\n>\n> - I have a customer who has heaviliy modified an oldish version of the\n> software.\n>\n> - I have identified the version that they modified and created a\n> branch in my git repo based on that version (i.e. what they would have\n> started with before modifying it)\n\nThat's the branch where you should apply their changes. Let name it \"theirs\".\nAnd I assume your normal branch is called master.\n\n> - Their changes where applied to a simple download - no version\n> control, no nothing.\n>\n> I now need to update them to the latest version of the software - can\n> git help me here or is it all a disaster?\n\nYou can have it with both merge and rebase.\nMerge:\n\n   $ git checkout master\n   $ git merge theirs\n\nNow your master contains a tree where their and your changes\nare mixed. Exactly how they are mixed (IOW, how you resolved\nconflicts, what exactly have you taken from their tree, etc) is\nrecorded in the merge commit. You can't export this information out\nof Git repo (so it is readily and simply usable without Git, that is).\nThat's usually not a problem.\n\nRebase:\n\n   $ git checkout theirs^0\n   $ git rebase master\n\nThe rebase can cause conflicts.\n\n   $ git branch new-theirs\n   $ git checkout new-theirs\n\nNow you are on a branch which contains their changes on top of your\ncurrent development branch. The software as \"they\" had it is in \"theirs\".\nYou can export their changes to your *current* tree to anyone as patches.\nNo one can tell anything about where the changes were created in the\nfirst place (the \"base\"), though. That's the major downside of the approach.\n\n> PS. To make matters worse - their original is full of expanced CVS\n> $Id:$ tags so it will look to git like every single file has changed.\n\nYou can filter them out using you favorite editor or scripting language\nand commit the filtered tree. Gits merge considers only the final\nstates of the branches it merges.\n"}]}