How to Remove GIT Merge Conflicts using Kdiff3 Tool


How to Remove GIT Merge Conflicts using Kdiff3 Tool

Many of them face conflicts issue while committing the code.

Follow the below steps to remove the conflicts very easily.

First, you need to install any merge tool in your system to resolve the conflicts.

GIT supports various visual merge tools to resolve the conflicts. Below are the few open source visual merge tools.

-> Kdiff3
-> tkdiff
-> xxdiff

git mergetool:
-> The git mergetool command allows for the integration of the above tools into the merge process.
-> It has already includes support for a number open source and freely available merge tools like, kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge, and opendiff.

Now we will see how to remove conflicts using Kdiff3 merge tool

Download and install Kdiff3 tool from below URL

http://sourceforge.net/projects/kdiff3/files/kdiff3/0.9.96/

After downloading add following code in your gitconfig file (path: C:Program FilesGitetc):

path = C:/Program Files/KDiff3/kdiff3.exe

trustExitCode = false
[difftool]
prompt = false
[diff]

tool = kdiff3
[mergetool “kdiff3”]
path = C:/Program Files/KDiff3/kdiff3.exe
trustExitCode = false
[mergetool]
keepBackup = false
[merge]
tool = kdiff3

Once the configuration is done, now you can use this tool to remove any merge conflicts.

Use the following commands after getting the merge conflicts.

-> git mergetool -t [toolname]
Ex: git mergetool -t kdiff3

after that it will ask you to hit return, then press enter, it will open a kdiff tool with code differentiate which causes the conflicts, in the bottom code window select which lines of code you need to commit, after selecting the lines of code, click on save and close the window.

After resolving merge conflicts use below commands to commit the code.

git commit -m ‘’

git push (push the code to remote repository)

Now your code is free from conflicts.

Comments 1

Your email address will not be published. Required fields are marked *

log in

Become a part of our community!

reset password

Back to
log in