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

Inexplicable merge conflict produced when when lines next to each other are changed

From
ADAnuradha Dissanayake <falconne@gmail.com>
Date
Apr 28, 2015, 07:34 UTC
Message-ID
<loom.20150428T093059-405@post.gmane.org>

I posted this question to StackOverflow a while ago but no one answered it so I thought I'd try here.

Let's say I have a file with this content in master:

_____ Line 1 Line 2 Line 3 Line 4 _____

Now say I create and checkout a new branch called Test. In this branch I change the file to this:

_____ Line 1 Line 2 Line 3 Modified Line 4 _____

and I commit this and switch back to master. In master I change the file to:

_____ Line 1 Line 2 Line 3 Line 4 Modified _____

and I commit. Now if I merge branch Test into master, I get a conflict.

Why can't git auto resolve this, as those are two entirely independent lines? If I tell git to edit conflicts using BeyondCompare as the difftool, BeyondCompare autoresolves this without even telling the user, since this isn't a real conflict (other merge tools we use at our company do so also). Is there a way to get git to autoresolve these? I've tried the recursive and resolve merge strategies but neither do it.

It's an issue in our company because there are certain files where multiple developers change lines in close proximity and this causes many unnecessary conflicts when they pull.

Next: Jeff King
Message 1 of 2 in “Inexplicable merge conflict produced when when lines next to each other are changed”
  1. Anuradha DissanayakeApr 28, 2015
  2. Jeff KingApr 29, 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.