Is there a way to completely turn off git's attempts to resolve conflicts before feeding files into 3-way merge tool?
I mean those lines:
<<<<<<< Temporary merge branch 1
...
=======
...
>>>>>>> Temporary merge branch 2
It adds them and branch changes into the base file before feeding it into kdiff3, and the later one goes completely mad showing weird conflicts.
I would like to simply have the base revision untouched.
So far I've only found the option
merge.conflictstyle
but it seems to have no option to turn these lines off.
Is there any way except writing a preprocessor that would strip the lines?
UPDATE
I'll explain what I dislike here.
The problem is that when git launches kdiff3 the BASE revision contains lines like
X1
<<<<<<< Temporary merge branch 1
A
=======
B
>>>>>>> Temporary merge branch 2
X2
The LOCAL revision contains:
X1
A
X2
And the REMOTE revision contains:
X1
B
X2
where X1
and X2
are some common lines of code between 3 files.
Now, kdiff3 signals a conflict here.
If I grab the files, copy them to a separate folder and remove everything between <
and >
, kdiff3 merges files way better, sometimes automatically.
From what I can see at http://www.gitguys.com/topics/merging-with-a-gui/, it looks like it actually should not show the lines in the BASE revision. But it does. How do I fix it?
Git config
git config -l
gives this:
core.symlinks=false
core.autocrlf=false
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
user.name=Pavel Gatilov
user.email=********
merge.tool=kdiff3
mergetool.kdiff3.path=C:/Program Files (x86)/KDiff3/kdiff3.exe
diff.guitool=kdiff3
difftool.kdiff3.path=C:/Program Files (x86)/KDiff3/kdiff3.exe
difftool.kdiff3.cmd="C:/Program Files (x86)/KDiff3/kdiff3.exe" "$LOCAL" "$REMOTE"
core.editor="C:/Program Files (x86)/GitExtensions/GitExtensions.exe" fileeditor
core.autocrlf=false
credential.helper=!"C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe"
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
core.safecrlf=true
remote.origin.url=********
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.develop.remote=origin
branch.develop.merge=refs/heads/develop
gui.wmstate=normal
gui.geometry=887x427+175+175 171 192
branch.8480-il.remote=origin
branch.8480-il.merge=refs/heads/8480-il
branch.branch-9354.remote=origin
branch.branch-9354.merge=refs/heads/branch-9354
Versions
I use:
Tool Version ------------------------ msysgit 1.8.1.msysgit.1 Git Extensions 2.44 kdiff3 0.9.97
The issue exists both when I run merge via Git Extensions and via git mergetool
UPDATE 2
I've tried configuring kdiff3 preprocessor command to remove the unwanted parts of files, but it seems to work on a per-line basis, so it can't fix the issue.
I could write a preprocessor-wrapper, but I don't want to do that yet.
A merge conflict is an event that takes place when Git is unable to automatically resolve differences in code between two commits. Git can merge the changes automatically only if the commits are on different lines or branches.
You can set flags in the .gitattributes to configure gits behavior, to turn of git conflict resolution, we can use the merge=union
flag to do this.
Example .gitattributes
* merge=union
Instead of specifying that all files have no merge option, we can also do this for a selective amount of files, for example:
*.java merge=union
src/generated/* merge=union
These lines tune the merge option for java files, and all files in the src/generated folder.
Isn't it a case of setting up the config variable mergetool.<tool>.cmd
to that you don't have the initial/default merge at all.
The git merge-tool
is used after the merge has happened (so says the manual)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With