git diff for custom 2 files outside of any repository?

前端 未结 2 1923
猫巷女王i
猫巷女王i 2021-01-26 19:33

I need git diff functionality for 2 files that I have outside of any repository. Is there a way to do it? Something like git diff --file1 /path/file1.txt --fi

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-26 20:17

    If the two files are really outside of any Git repository, then Git effectively doesn't "know" anything about these files, and so git diff won't work. But, the regular Linux diff command should work. So instead of doing:

    git diff /path/to/file1.txt /path/to/file2.txt
    

    do this:

    diff /path/to/file1.txt /path/to/file2.txt
    

提交回复
热议问题