Although much of the information in this question and answer is available on StackOverflow, it is spread out over lots of pages and among other answers which are either wrong or misleading. It took me a while to piece together everything I wanted to know.
There are a lot of different programs that can be used as your git difftool and mergetool, and there is certainly no consensus as to which is the best (opinions, requirements, and OSes will clearly differ).
Meld is a popular free, open-source, and cross-platform (UNIX/Linux, OSX, Windows) choice as shown in the StackOverflow question, What’s the best visual merge tool for Git?, in which the answer proposing Meld has more than 3 times the votes as any other tool.
The following 2 questions will be answered in my answer below:
- How do I set up and use Meld as my git difftool?
- How do I set up and use Meld as my git mergetool?
Note: It is not necessary to use the same program as both your difftool and mergetool, different programs can be set for both.