Setup p4merge as merge/diff tool
Download and install p4merge
My recommend way doing this is to use chocolatey installing p4merge like this: choco install p4merge -y
Alternativly you can download and install p4merge by yourself: http://www.perforce.com/perforce/downloads/index.html
Configure p4merge as merge and diff tool
You are able to configure p4merge in two ways: using the console or editing the git config file. (in your user directory ->
.gitconfig
)Run the console commands
To add p4merge as visual merge tool, run the following commands in your console. You can also edit your gitconfig file directly.
$ git config --global diff.tool p4merge
$ git config --global difftool.p4merge.path 'C:\Program Files\Perforce\p4merge.exe'
To setup p4merge as visual diff tool, run the next commands in your console. ASe before you can add the necessary lines to your local .gitconfig file by yourself.
$ git config --global merge.tool p4merge
$ git config --global mergetool.p4merge.path 'C:\Program Files\Perforce\p4merge.exe'
I also added the functionality to automagically clean up my git working directoy after a conflict. You just have to run this command:
git config --global mergetool.keepBackup false
The final config file result
[diff]
tool = p4merge
[difftool "p4merge"]
path = C:\\Program Files\\Perforce\\p4merge.exe
[merge]
tool = p4merge
[mergetool "p4merge"]
path = C:\\Program Files\\Perforce\\p4merge.exe
[mergetool]
keepBackup = false
Run p4merge from your git bash
git mergetool