05实用技术/Git - p4merge

Windows 下配置

先确保 p4merge 的路径(默认:C:\Program Files\Perforce\)在环境变量中

1
2
3
4
C:\Users\zjffu>where p4merge
C:\Program Files\Perforce\p4merge.exe
C:\Users\zjffu>path
...;C:\Program Files\Perforce\;...

然后

1
2
3
4
5
git config --global diff.tool p4merge
git config --global difftool.p4merge.cmd 'p4merge "$LOCAL" "$REMOTE"'

git config --global merge.tool p4merge
git config --global mergetool.p4merge.cmd 'p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"'

使用

1
2
git difftool
git mergetool