Meld
The following PowerShell uses Chocolatey to install meld and configures it as the diff and merge tool for Git. Note that meld is an officially supported diff tool in Git for Windows.cinst meld git config --global diff.tool meld git config --global merge.tool meld git config --global mergetool.meld.keeptemporaries false git config --global mergetool.meld.trustExitCode false git config --global mergetool.meld.keepbackup false
P4Merge (Perforce Merge)
The following PowerShell uses Chocolatey to install p4merge and configures it as the diff and merge tool for Git. Note that p4merge is an officially supported diff tool in Git for Windows.cinst p4merge git config --global diff.tool p4merge git config --global merge.tool p4merge git config --global mergetool.p4merge.keeptemporaries false git config --global mergetool.p4merge.trustExitCode false git config --global mergetool.p4merge.keepbackup false
Semantic Merge
If you're coding in C#, it may be worth using Semantic Merge (also installable via Chocolatey). Note that this set of commands sets up the PlasticSCM merge tool as the fall-back when not merging C#.cinst SemanticMerge git config --global diff.tool semantic git config --global merge.tool semantic $semanticMergeUserPath = Resolve-Path ~\AppData\local\PlasticSCM4\semanticmerge\semanticmergetool.exe git config --global difftool.semantic.cmd ('''' + $semanticMergeUserPath + ''' -d=\"$LOCAL\" -s=\"$REMOTE\" -edt=\"mergetool.exe -d=\"\"@sourcefile\"\" -dn=\"\"@sourcesymbolic\"\" -s=\"\"@destinationfile\"\" -sn=\"\"@destinationsymbolic\"\" -t=\"\"@filetype\"\" -i=\"\"@comparationmethod\"\" -e=\"\"@fileencoding\"\"\"') git config --global mergetool.semantic.cmd ('''' + $semanticMergeUserPath + ''' -b=\"$BASE\" -d=\"$LOCAL\" -s=\"$REMOTE\" -r=\"$MERGED\" -l=csharp -emt=\"mergetool.exe -b=\"\"@basefile\"\" -bn=\"\"@basesymbolic\"\" -s=\"\"@sourcefile\"\" -sn=\"\"@sourcesymbolic\"\" -d=\"\"@destinationfile\"\" -dn=\"\"@destinationsymbolic\"\" -r=\"\"@output\"\" -t=\"\"@filetype\"\" -i=\"\"@comparationmethod\"\" -e=\"\"@fileencoding\"\"\" -edt=\"mergetool.exe -s=\"\"@sourcefile\"\" -sn=\"\"@sourcesymbolic\"\" -d=\"\"@destinationfile\"\" -dn=\"\"@destinationsymbolic\"\" -t=\"\"@filetype\"\" -i=\"\"@comparationmethod\"\" -e=\"\"@fileencoding\"\"\"') git config --global mergetool.semantic.keeptemporaries false git config --global mergetool.semantic.trustExitCode false git config --global mergetool.semantic.keepbackup false
Other merge tools
You can see which diff tools are supported natively by git by running the following command:
git difftool --tool-help
You'll see something like the following result:
'git difftool --tool-<tool>' may be set to one of the following: gvimdiff gvimdiff2 vimdiff vimdiff2 The following tools are valid, but not currently available: araxis bc3 codecompare defaults deltawalker diffuse ecmerge emerge kdiff3 kompare meld opendiff p4merge tkdiff vim xxdiff Some of the tools listed above only work in a windowed environment. If run in a terminal-only session, they will fail.