git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How can I ignore insignificant change during merge ?

From
John Keeping <john@keeping.me.uk>
Date
Oct 5, 2015, 20:34 UTC
Message-ID
<20151005203432.GR17201@serenity.lan>
In-Reply-To
<CA+aSyzqxjoUbGbPvLMNcrYyE3ZAqwGYiXtSrUgg8O29MZLJWrA@mail.gmail.com>
On Mon, Oct 05, 2015 at 10:13:00PM +0200, Jens Brejner wrote:
Show 29 quoted lines
> I need to merge a branch, +100k changes. The vast majority of changes
> are insignificant, because they only represent a screen position in
> the editor, so these changes should never have been in git - but but
> MadCap Flare already put them there.
> 
> The files in question are xml, and the difference can be exemplifed like this:
> 
> Original (when branches were created):
> html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd"
> MadCap:lastBlockDepth="5" MadCap:lastHeight="32"
> MadCap:lastWidth="400"
> Branch1:
> html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd"
> MadCap:lastBlockDepth="5" MadCap:lastHeight="24"
> MadCap:lastWidth="500"
> Branch2:
> html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd"
> MadCap:lastBlockDepth="5" MadCap:lastHeight="41"
> MadCap:lastWidth="300"
> 
> How can git help me so files where the only difference matches
> something like this regex:
> /html xmlns:.* MadCap:lastHeight="\d+" MadCap:lastWidth="\d+"/
> 
> for the files that qualify, I want git to ignore the change, and
> therefore the merge-conflict, and then just accept "my" file for the
> merged changeset.
> 
> Any suggestions on how to I can have git help me with that ?

Have you looked into defining a custom merge driver for these files? It's documented in the "Performing a three-way merge" section of gitattributes(5) - that is, "git help attributes".

It should be relatively easy to ignore these changes, but you'll have to deal with merging the rest of the files as well; Python's difflib module may be useful.

Previous: Jens Brejner
Message 2 of 2 in “How can I ignore insignificant change during merge ?”
  1. Jens BrejnerOct 5, 2015
  2. John KeepingOct 5, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.