Git is my favorite SCV system up to now and most probably will be in the future. Besides of many great features is has pretty good automatic merge tool, that is able to solve conflicts, but not all of them. I found p4merge tool much better in case of automatic merging and manual solving the most hard conflicts. Is is very simple to mix together those two things to have the best from both of them and now I will show you how to do that.
I'm guessing there's a CLI tool for p4merge (which I know nothing about). I wrote a blog post about using Changes.app, and some other GUI tools with Mercurial: Using Mercurial with GUI Tools. Basically, you need to know the calling expectations of the CLI tool that loads up the diff tool. These steps worked for me. After downloading and installing P4Merge tool from perforce.com. After your profile name/email id. Replace this content in your /.gitconfig file. Configuring Git Diff and Merge tool (p4merge) for Mac (Lab) Git Comparison with Git Diff Tool (p4merge) Viewing and Comparing changes - Git Working directory vs Staged (Lab). P4Merge Preferences (Mac). Preferences Color Scheme Application color scheme has the option for Dark Theme, in addition to the default of Light Theme. To configure P4Merge settings for the current session to.
First of all, you have to install p4merge tool. Go to p4merge tool download page, choose “Browse by platform” tab, pick your platform (in my case it was Macintosh) and download P4V: Visual Client. After downloading, open dmg file and copy p4merge tool to Applications folder in your Dock.
Download P4merge Mac Pro
Second step is to create two simple bash scripts: p4merge and p4diff, that will be executed when git needs merge or diff tool. Create these scripts in directory that is in your’s system PATH (i.e. /usr/local/bin/).
![P4merge P4merge](https://chars.tech/assets/images/tech/git-diff-p4merge.png)
p4merge
Download P4merge Macbook Pro
p4diff
Don’t forget to add executable mode/flag to these scripts.
After p4merge and scripts are ready it’s time to configure global git settings. Edit ~/.gitconfig file and put following configuration there for merging:
Download P4merge Mac Download
If you don’t want to use p4merge as diff tool, just comment (using # character) [diff] section. Sometimes it’s faster for me to use command line diff instead of visual one.
Download P4merge Mac Os
Now, when you type “git diff” or “git mergetool” in your’s project directory, p4merge tool will be started.