git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anuradha Dissanayake <falconne@gmail.com>
To: git@vger.kernel.org
Subject: Inexplicable merge conflict produced when when lines next to each other are changed
Date: Tue, 28 Apr 2015 07:34:30 +0000 (UTC)	[thread overview]
Message-ID: <loom.20150428T093059-405@post.gmane.org> (raw)

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.

             reply	other threads:[~2015-04-28  7:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-28  7:34 Anuradha Dissanayake [this message]
2015-04-29  2:35 ` Inexplicable merge conflict produced when when lines next to each other are changed Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20150428T093059-405@post.gmane.org \
    --to=falconne@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).