Friday, May 14, 2021

GIT - merge P4MERGE

 config p4merge

You may need to add path to 'perforce' in program files to use 'p4merge' as a terminal command


config p4merge with git, we need to add configuration


1. config merge too for git

git config --global --merge.tool p4merge


2. where to look for the p4merge

git config --global mergetool.p4merge.path "C:/Program Files/Perforce/p4merge.exe"


3. Not to promt p4merge when a conflict comes

git config --global mergetool.promt false


4. set up diff tool. here we set up p4merge, same tool

git config --global diff.tool p4merge


5. where to look for the p4merge

git config --global difftool.p4merge.path "C:/Program Files/Perforce/p4merge.exe"


6. Not to promt p4merge always

git config --global difftool.promt false


Note: different in config --merge  and --mergetool same in "diff" and "difftool"

-- merge for git and --mergetool for the tool specific configurations as the name suggest.


7. Let's check all the configurations

git config --global --list


git config --global -e

.gitconfig file snip

[merge]

tool = p4merge

[mergetool "p4merge"]

path = C:/Program Files/Perforce/p4merge.exe

[diff]

tool = p4merge

[difftool "p4merge"]

path = C:/Program Files/Perforce/p4merge.exe

[difftool]

prompt = false

[mergetool]

prompt = false


For Mac User 

git config --global mergetool.p4merge.path /Applications/p4merge.app/Contents/MacOS/p4merge

git config --global merge.tool p4merge

git config --global difftool.p4merge.path /Applications/p4merge.app/Contents/MacOS/p4merge

git config --global diff.tool p4merge


Disable is same for both Windows and Mac

git config --global difftool.prompt false 

git config --global mergetool.prompt false


.gitconfig file snip

[diff]

tool = p4merge

[merge]

tool = p4merge

[difftool "p4merge"]

path = /Applications/p4merge.app/Contents/MacOS/p4merge

[mergetool "p4merge"]

path = /Applications/p4merge.app/Contents/MacOS/p4merge

[difftool]

prompt = false

[mergetool]

prompt = false


No comments:

Post a Comment