Share via


Resolving code conflict using p4merge with git on Windows

One of the most common task for professional software engineer is to merge code from multiple branch, on popular source control system git which enables configuring third party merging tool to facilitate this process. p4merge is a visual merging tool developed by Perforce. Here is how to get it work on Windows operating system. 

1. Download and install p4merge. Go to https://www.perforce.com/downloads/complete_list , select a version of p4v according to your platform to download and install. p4v is the name of Perforce Visual Merge and Diff tool which includes the fantastic p4merge. 

2. Configure git to use p4merge. The configuration file .gitconfig is located under c:\users\YourLogin\, open that file and add the following lines 

 [merge]
    tool = p4merge
[mergetool "p4merge"]
    cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
    keepTemporaries = false
    trustExitCode = false
    keepBackup = false
[diff]
    tool = p4merge
 3. invoke the p4merge in git console is super simple, just type the following. 
 git mergetool 

Comments

  • Anonymous
    April 07, 2013
    Awesome! This is EXACTLY what I've been looking for. You just made my day thanks.