{"thread":{"id":"40488","subject":"How can I ignore insignificant change during merge ?","startedAt":"2015-10-05T20:13:00Z","lastAt":"2015-10-05T20:34:32Z","messageCount":2,"participants":["Jens Brejner","John Keeping"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"271158","messageId":"CA+aSyzqxjoUbGbPvLMNcrYyE3ZAqwGYiXtSrUgg8O29MZLJWrA@mail.gmail.com","threadId":"40488","inReplyTo":null,"subject":"How can I ignore insignificant change during merge ?","fromName":"Jens Brejner","fromEmail":"jens@kaabrejner.dk","sentAt":"2015-10-05T20:13:00Z","receivedAt":"2015-10-05T20:13:00Z","isPatch":false,"sender":{"key":"jens@kaabrejner.dk","avatar":null},"body":"I need to merge a branch, +100k changes. The vast majority of changes\nare insignificant, because they only represent a screen position in\nthe editor, so these changes should never have been in git - but but\nMadCap Flare already put them there.\n\nThe files in question are xml, and the difference can be exemplifed like this:\n\nOriginal (when branches were created):\nhtml xmlns:MadCap=\"http://www.madcapsoftware.com/Schemas/MadCap.xsd\"\nMadCap:lastBlockDepth=\"5\" MadCap:lastHeight=\"32\"\nMadCap:lastWidth=\"400\"\nBranch1:\nhtml xmlns:MadCap=\"http://www.madcapsoftware.com/Schemas/MadCap.xsd\"\nMadCap:lastBlockDepth=\"5\" MadCap:lastHeight=\"24\"\nMadCap:lastWidth=\"500\"\nBranch2:\nhtml xmlns:MadCap=\"http://www.madcapsoftware.com/Schemas/MadCap.xsd\"\nMadCap:lastBlockDepth=\"5\" MadCap:lastHeight=\"41\"\nMadCap:lastWidth=\"300\"\n\nHow can git help me so files where the only difference matches\nsomething like this regex:\n/html xmlns:.* MadCap:lastHeight=\"\\d+\" MadCap:lastWidth=\"\\d+\"/\n\nfor the files that qualify, I want git to ignore the change, and\ntherefore the merge-conflict, and then just accept \"my\" file for the\nmerged changeset.\n\nAny suggestions on how to I can have git help me with that ?\n\nBest regards\nJens Brejner\n"},{"id":"271170","messageId":"20151005203432.GR17201@serenity.lan","threadId":"40488","inReplyTo":"CA+aSyzqxjoUbGbPvLMNcrYyE3ZAqwGYiXtSrUgg8O29MZLJWrA@mail.gmail.com","subject":"Re: How can I ignore insignificant change during merge ?","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2015-10-05T20:34:32Z","receivedAt":"2015-10-05T20:34:32Z","isPatch":false,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"On Mon, Oct 05, 2015 at 10:13:00PM +0200, Jens Brejner wrote:\n> I need to merge a branch, +100k changes. The vast majority of changes\n> are insignificant, because they only represent a screen position in\n> the editor, so these changes should never have been in git - but but\n> MadCap Flare already put them there.\n> \n> The files in question are xml, and the difference can be exemplifed like this:\n> \n> Original (when branches were created):\n> html xmlns:MadCap=\"http://www.madcapsoftware.com/Schemas/MadCap.xsd\"\n> MadCap:lastBlockDepth=\"5\" MadCap:lastHeight=\"32\"\n> MadCap:lastWidth=\"400\"\n> Branch1:\n> html xmlns:MadCap=\"http://www.madcapsoftware.com/Schemas/MadCap.xsd\"\n> MadCap:lastBlockDepth=\"5\" MadCap:lastHeight=\"24\"\n> MadCap:lastWidth=\"500\"\n> Branch2:\n> html xmlns:MadCap=\"http://www.madcapsoftware.com/Schemas/MadCap.xsd\"\n> MadCap:lastBlockDepth=\"5\" MadCap:lastHeight=\"41\"\n> MadCap:lastWidth=\"300\"\n> \n> How can git help me so files where the only difference matches\n> something like this regex:\n> /html xmlns:.* MadCap:lastHeight=\"\\d+\" MadCap:lastWidth=\"\\d+\"/\n> \n> for the files that qualify, I want git to ignore the change, and\n> therefore the merge-conflict, and then just accept \"my\" file for the\n> merged changeset.\n> \n> Any suggestions on how to I can have git help me with that ?\n\nHave you looked into defining a custom merge driver for these files?\nIt's documented in the \"Performing a three-way merge\" section of\ngitattributes(5) - that is, \"git help attributes\".\n\nIt should be relatively easy to ignore these changes, but you'll have to\ndeal with merging the rest of the files as well; Python's difflib module\nmay be useful.\n"}]}