Configuring Git Diff And Merge Tool P4merge For Mac

Configuring Git Diff And Merge Tool P4merge For Mac

Configuring Git Diff And Merge Tool P4merge For Mac Average ratng: 4,6/5 5165 votes

Since git diff in powershell mostly results in a unreadable amount of whitespace or strange characters, I installed Perforce P4Merge, to handle merging and diff.However, I can't make git diff open the p4merge application to view the diff in. So far my.gitconfig looks like this: difftool = p4diffdifftool 'p4diff'external = 'C:/PROGRA1/Perforce/p4merge.exe '$LOCAL' '$REMOTE'prompt = falsemergekeepBackup = falsetool = p4mergemergetool 'p4merge'cmd = '$BASE' '$LOCAL' '$REMOTE' '$MERGED'path = 'C:/PROGRA1/Perforce/p4merge.exe'prompt = falsekeepBackup = falsekeepTemporaries = falsetrustExitCode = falseThe paths are correct. But alas, git still attempts to present the diff in Powershell, when using git diff.So what's the trick to make this work?

I'm on WIndows 7 using MSysGit v1.8.4.For me, the only solution was to add p4merge to the system path variable (reboot needed afterwards). Having done this, i conf'd it like this: git config -global diff.tool p4mergegit config -global difftool.p4merge.cmd 'p4merge.exe $LOCAL $REMOTE'git config -global difftool.prompt falsegit config -global merge.tool p4mergegit config -global mergetool.p4merge.cmd 'p4merge.exe $BASE $LOCAL $REMOTE $MERGED'git config -global mergetool.prompt falsegit config -global mergetool.trustExitCode falsegit config -global mergetool.keepBackup falseI recommend you stick to 'git config' instead of editing the conf manually because hyphens etc sometimes are different between these methods.

One of my favorite Nintendo NES games was. It made you finish the game. At level 30, you couldn’t gain any more experience points. The mentor wizard person (because there’s always a mentor wizard person) would tell you, “Aren’t you strong enough to defeat the DragonLord?”As I debated whether I knew enough to write a tip about configuring your git diff and merge tools, I ask myself “Aren’t you strong enough to defeat the git diff merge config tool?!”More about the game at bottom of postFor today’s tip, I’m using the andLet’s start by engaging in epic battle with the git-scm instructions. I’m going to assume you’ve installed p4merge. Yes I know there are others, but for now, I’m going to follow these instructions. The journey to 3rd degree black belt starts with a single punch.These are the two lines I get stuck on: $ git config -global merge.tool extMerge$ git config -global mergetool.extMerge.cmd 'extMerge '$BASE' '$LOCAL' '$REMOTE' '$MERGED'so why need two lines?

This article was incredibly helpful getting Tortoise Git setup for LabVIEW Compare and LabVIEW Merge tools. I had done so successfully in the past with Tortoise SVN and it was harder to find the same resources for git.

Perhaps I’m not recalling enough of my shell programming or the translation fails over to Windows? The instructions saySet up a merge wrapper script named extMerge that calls your binary with all the arguments providedso `extMerge` is a variable. But why can’t you have it all on the same line?? What am I missing?and also, what is “mergetool”?

Mac

Is it yet another variable? And how does it differ from merge.tool?AnywaysI’ll assume you have p4merge installed here in C:Program FilesPerforceThanks to we can setup p4merge as our merge and diff tools using Git Shell (I’m using Git Bash)$ git config –global diff.tool p4merge$ git config –global difftool.p4merge.path ‘C:Program FilesPerforcep4merge.exe’$ git config –global merge.tool p4merge$ git config –global mergetool.p4merge.path ‘C:Program FilesPerforcep4merge.exe’Now let’s create a merge conflict, but this time, I’m going to keep my heart rate low when the (master MERGING) appears! Btw I called my branch `conflicting` just because.now you can type in git mergetoolI’m not going to go over p4merge, but I think the “error” showing for the base file is because p4merge is trying to do a 3-way merge, but only has 2 files. Don’t quote me on this.After modifying the resulting myfile1.text and hitting save in p4merge and closing it, we’re back to the merge conflict state.

Configuring Git Diff And Merge Tool P4merge For Mac

This used to freak me out because git didn’t “move on”. But now I know what to do!You can do a `git status` to verify where you are at.Perfect! We’re done with myfile1.txt and it is staged. Since it is staged, we can simply commit it via `git commit -m “my merge message”`And boom! I’ve now done epic battle with one of my most feared Git foes.The most memorable aspect of the game was the ending but not for the reasons you’d think. The game had their basic “hero” ending, but it also offered a twist. Before going into battle with the Dragonlord, he’d ask you to join him in being evil and taking over the universe.

If you said yes, the game would “freeze” and IIRC, it would erase your saved game! I’ve never heard of another game doing this. There’s the “did you give a dog a sandwich?” story, but not a “come join the dark side” option destroying your saved game!