0

Say I have a file and I have two branches: master and anotherbranch.

The current situation is that from the point of divergence, master branch has one commit (say a line in the file says "This is master") and the "anotherbranch" branch also has a commit (the same line says "this is another").

Obviously if you checkout master and do git merge there is going to be conflict and you can solve it by solving the conflict and commiting the branch.

But now I want to try the git mergetool tool so I checkout master and I do:

git mergetool

This message is displayed because 'merge.tool' is not configured.
See 'git mergetool --tool-help' or 'git help config' for more details.
'git mergetool' will now attempt to use one of the following tools:
tortoisemerge emerge vimdiff
No files need merging

Anyway disregard the first part (I solved that by configuring the tool) but notice the last line No files need merging

What? no files need merging. Well that is simply not true. The file needs merging so why is this not working?

KansaiRobot
  • 3,881
  • 3
  • 33
  • 74
  • Did you checked out both branches before `git merge master` ? – PStarczewski Nov 25 '18 at 09:49
  • I did not do `git merge master`. I am trying to learn to use `mergetoool` – KansaiRobot Nov 25 '18 at 09:50
  • 2
    You first have to run e.g. `git checkout master; git merge anotherbranch`, and then, in case there is a collision, run `git mergetool`. – alfunx Nov 25 '18 at 09:56
  • @alfunx I am sorry, I don't understand what is the logic behind that. If I do `git merge` and solve the conflicts there is no need to do mergetool anymore. In fact I did the following before (following my book); `git checkout master`, then `git merge anotherbranch` and voila. Solved. There is no need for mergetool as you guys wrote. The thing is I want to use mergetool not merge – KansaiRobot Nov 25 '18 at 09:59
  • 3
    @KansaiRobot `git mergetool` is *not* some general purpose tool to perform merges, it is a tool that can help you solve conflicts. Consider: https://stackoverflow.com/questions/161813/how-to-resolve-merge-conflicts-in-git – alfunx Nov 25 '18 at 10:01
  • I understood now. (https://stackoverflow.com/a/32290725/4451521). In the end, I managed to run mergetool and I have to report it is a very unuseuful "tool". Not planning to use it anymore – KansaiRobot Nov 25 '18 at 10:14
  • @KansaiRobot It is a very useful tool for me. I prefer to see conflicts as 2-way or 3-way diff in an editor, instead of the raw file with the Git conflict markers. – alfunx Nov 25 '18 at 10:23

0 Answers0