git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* How can I ignore insignificant change during merge ?
@ 2015-10-05 20:13 Jens Brejner
  2015-10-05 20:34 ` John Keeping
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Brejner @ 2015-10-05 20:13 UTC (permalink / raw
  To: git

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 ?

Best regards
Jens Brejner

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How can I ignore insignificant change during merge ?
  2015-10-05 20:13 How can I ignore insignificant change during merge ? Jens Brejner
@ 2015-10-05 20:34 ` John Keeping
  0 siblings, 0 replies; 2+ messages in thread
From: John Keeping @ 2015-10-05 20:34 UTC (permalink / raw
  To: Jens Brejner; +Cc: git

On Mon, Oct 05, 2015 at 10:13:00PM +0200, Jens Brejner wrote:
> 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-05 20:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-05 20:13 How can I ignore insignificant change during merge ? Jens Brejner
2015-10-05 20:34 ` John Keeping

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).