I want to use it to diff two files which does not belong to any git project. Note that I want to use git diff as a difftool, not set git diff to any difftool.
1 Answer
As mentioned in the documentation, it should be possible when you pass --no-index
git diff [<options>] --no-index [--] <path> <path>
compare the given two paths on the filesystem. You can omit the --no-index option when running the command in a working tree controlled by Git and at least one of the paths points outside the working tree, or when running the command outside a working tree controlled by Git.This form is to
git diff --no-index file1 file2?