Can I use git diff
to compare a file in a remote branch with a file on the local file system outside of any git repositories? I want to accomplish this without creation of any temporary files.
git diff origin/release/1.0.1:pom.xml /tmp/pom.xml
error: Could not access 'origin/release/1.0.1:pom.xml'
which isn't true as the file exists in that branch
But if run the command below:
git diff origin/release/1.0.1:pom.xml -- /tmp/pom.xml
fatal: /tmp/pom.xml '/tmp/pom.xml' is outside repository
This error is more understandable
I've read the help
git help diff
but haven't found any useful info related to this case. Is it possible?
As a workaround I use:
vimdiff <(git show origin/release/1.0.1:pom.xml) <(cat /tmp/pom.xml)
I use git version 2.17.1