Question: 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?

Answer: 
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.
I don't know what's happening to me since I updated OS X and now opendiff is not working as it used to be.
So I copied this script from [here](https://gist.github.com/miner/e73fc98a83a8fe05d9ef000d46d68a9f) and it worked.

```
#!/bin/sh 
dir=$PWD
until [ -e "$dir/.git" ]; do
  if [ "$dir" == "/" ]; then
    echo "Not a git repository" >&2
    exit 1;
  fi
  dir=`dirname "$dir"`
done
open -a FileMerge -n -W --args -left "$dir/$1" -right "$2" -merge "$5"

```