3

I'm having trouble trying to use git difftool (in this case, opendiff for mac) to visualise the differences made in the latest git commit. I don't want to launch opendiff for each pair of files that has changed, I just want to launch one instance of opendiff which compares the entire directory, so I've followed the advice from this answer which is to use --dir-diff. I ended up using this command:

git difftool HEAD^ HEAD --dir-diff

The problem is that when I launch this command, the opendiff says that there are 0 differences (even though using normal diff will show differences in multiple files). What's going on? How do I use difftool correctly?

3
  • That answer specifies that the diff tool must be able to "compare two directory hierarchies at a time after populating two temporary directories". Can opendiff do that? Commented Jun 29, 2014 at 14:37
  • The command you provided works well for me with meld on Linux. Maybe opendiff issue? Commented Jun 29, 2014 at 15:00
  • Perhaps git log -p -1 would be useful? Commented Aug 27, 2014 at 14:22

1 Answer 1

1

The files get deleted immediately because opendiff (the command line tool) exits straight after launching FileMerge (the GUI tool). You need to write a short wrapper script that will copy the left and right folders to (another) temp location and start opendiff with those locations.

Edit: you can configure a custom difftool that will start FileMerge directly and wait for it to exit. Add this to your ~/.gitconfig

[difftool "fm"]
cmd = /Applications/Xcode.app/Contents/Applications/FileMerge.app/Contents/MacOS/FileMerge -left \"$LOCAL\" -right \"$REMOTE\"
path =
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.