This is not exactly what you asked for, but it might give you the results you want: Add project2
as a remote of project1
and just git diff
their HEAD
s.
git remote add other ../project2/.git
git fetch other
# Perform the diff
git diff other/HEAD
If your project2
is not already a Git repo, you can temporarily make it one (hat tip to Josiah Yoder for his comments):
# Set up project2 repo
cd ../project2
git init
git add .
# Add as remote from project1
cd ../project1
git remote add other ../project2/.git
git fetch other
# Perform the diff
git diff other/master
# Clean up
git remote remove other
cd ../project2
rm -r .git