Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I pipe in FileMerge as a diff tool with git on OS X?

I'm new to git on OS X, and I'm using it via the command line. I come from the world of Tortoise SVN and Beyond Compare on Windows.

I want to be able to send diffs to FileMerge.

I was able to do this with TextMate simply by using:

git diff | mate 

But I'm not sure how to get that set up so I can use FileMerge instead?

like image 338
doug Avatar asked Mar 18 '10 00:03

doug


People also ask

How do I open git diff tool?

Go to your repository in Git Bash. Type git config diff. tool winmerge . Verify it worked by typing git difftool .

What is git diff command?

Diffing is a function that takes two input data sets and outputs the changes between them. git diff is a multi-use Git command that when executed runs a diff function on Git data sources. These data sources can be commits, branches, files and more.

How do I use git beyond compare?

Tower (Git)Launch Beyond Compare, go to the Beyond Compare menu and run Install Command Line Tools. Open Tower's preferences dialog on the Git Config Tab. Set the Diff Tool drop-down to Beyond Compare. Set the Merge tool drop-down to Beyond Compare.


2 Answers

Although it's not exactly the same as piping stdin into a script, you can do this:

git difftool -t opendiff -y 

That will launch FileMerge once for each file. Doing the whole project tree at once takes a little scripting.

See also this question.

like image 102
Erin Dees Avatar answered Oct 08 '22 10:10

Erin Dees


Create an executable script git-diff-cmd.sh

#!/bin/bash  xattr -w com.apple.TextEncoding "UTF-8;134217984" "$2" xattr -w com.apple.TextEncoding "UTF-8;134217984" "$5"  /usr/bin/opendiff "$2" "$5" -merge "$1" 

Now edit your .gitconfig file to include the lines

[diff]     external = <path-to>/git-diff-cmd.sh 

...replacing <path-to> by the path to git-diff-cmd.sh. Now git diff will use FileMerge, and correctly display UTF-8 Unicode characters.

like image 30
Syzygies Avatar answered Oct 08 '22 10:10

Syzygies