To setup p4merge (3 way merge) as your default mergetool brew cask install p4merge
And paste below text in your global .gitconfig
file. Which can be found in your home directory.
[merge]
keepBackup = false
tool = p4merge
[mergetool "p4merge"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "\"$PWD/$BASE\"" "\"$PWD/$REMOTE\"" "\"$PWD/$LOCAL\"" "\"$PWD/$MERGED\""
keepTemporaries = false