If stopping the process is not enough, killing the shell itself (in which you launched the git diff
) might be more effective.
See also Git Diff with Vimdiff
Not being ready to go full speed into using vimdiff
(I’m just new to it), I put the following in ‘gitvimdiff
’.
The result is that I can use vimdiff
to look at git-diff by running ‘gitvimdiff
‘, but a normal invocation of ‘git diff
’ behaves as I’m used to.
#!/bin/sh
if [ -n "${GIT_EXTERNAL_DIFF}" ]; then
[ "${GIT_EXTERNAL_DIFF}" = "${0}" ] ||
{ echo “GIT_EXTERNAL_DIFF set to unexpected value” 1>&2; exit 1; }
exec vimdiff “$2″ “$5″
else
GIT_EXTERNAL_DIFF=”${0}” exec git –no-pager diff “$@”
fi
But if you still want the modified git diff
, a git status
might help before launching it ;)
And you can setup a function to get the old git diff
behavior if needed:
I still have access to the default git diff behavior with the --no-ext-diff
flag. Here’s a function I put in my bash configuration files:
function git_diff() {
git diff --no-ext-diff -w "$@" | vim -R -
}
--no-ext-diff
: to prevent using vimdiff
-w
: to ignore whitespace
-R
: to start vim in read-only mode
-
: to make vim act as a pager
git mergetool
too. – Historiography