Skip to content

Instantly share code, notes, and snippets.

@TauPan
Created July 25, 2011 12:27
Show Gist options
  • Save TauPan/1104020 to your computer and use it in GitHub Desktop.
Save TauPan/1104020 to your computer and use it in GitHub Desktop.
Viewing differences in git with emacs-ediff
#!/bin/sh
# adapted from http://technotales.wordpress.com/2009/05/17/git-diff-with-vimdiff/
if [ -n "${GIT_EXTERNAL_DIFF}" ]; then
[ "${GIT_EXTERNAL_DIFF}" = "${0}" ] ||
{ echo "GIT_EXTERNAL_DIFF set to unexpected value" 1>&2; exit 1; }
exec emacsclient --eval "(ediff \"$2\" \"$5\")"
else
GIT_EXTERNAL_DIFF="${0}" exec git --no-pager diff "$@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment