gitbranching-and-merginggit-mergekdiff3mergetool

git tells me that I Merge conflict, but also tells me that no files need merging


I committed some changes in the branch new.

I checkout out to master.

When I tried to merge:

$ git merge new
Auto-merging js/site.js
CONFLICT (content): Merge conflict in js/site.js
Automatic merge failed; fix conflicts and then commit the result.

So I installed kdiff3 and configured my config files and when I tried to use mergetools I got:

$ git mergetool kdiff3
No files need merging

I ran a diff and it outputted this:

diff --cc js/site.js
index 8c17d62,7955b13..0000000
--- a/js/site.js
+++ b/js/site.js
@@@ -72,4 -81,18 +81,22 @@@ function doSmallScreen()

  $(document).ready(function () {
      calculateScreen();
- });
++<<<<<<< HEAD
++});
++=======
+     $(window).resize(function () {
+         delay(function () {
+             calculateScreen();
+         }, 500);
+     });
+ });
+
+
+ var delay = (function () {
+     var timer = 0;
+     return function (callback, ms) {
+         clearTimeout(timer);
+         timer = setTimeout(callback, ms);
+     };
 -})();
++})();
++>>>>>>> new

I am confused as to how to solve this, I want to solve this in the simplest manner possible, I don't really care if I lose the information from the branch new, but I want to understand what went wrong and why I can't use the merge tools.

It just seem weird to me that I have a merge conflict but no files need to be merged.


Solution

  • I think your mergetool command is wrong. Should be

    $ git mergetool
    

    Or

    $ git mergetool --tool=kdiff3
    

    If you get stuck with a git command you can always check the manual (git mergetool --help).

    More Info: https://www.kernel.org/pub/software/scm/git/docs/git-mergetool.html