답변:
다음은 나를 위해 작동합니다.
git diff master:foo foo
과거에는 다음과 같을 수 있습니다.
git diff foo master:foo
--매개 변수를 경로 인수와 구분하기 위해을 사용해 보셨습니까 ? git diff -- master:foo foo
git diff -- master:foo foo작동하지 않습니다. arg master:foo는 지점에있는 파일 대신 존재하지 않는 파일 이름으로 간주 하고 무시합니다. 마지막 2 개 args를 전환 해보십시오. 만약 작동한다면 diff 비교는 반대로되지만 출력은 바뀌지 않습니다.
git diff master:foo foo반대입니다. 나는 할 수 있지만 그 반대는 아닙니다. 나는 그것을 이해하지 못한다. git 1.7.9.5 / Ubuntu 12.04를 사용하면 적어도 git diff -R master:foo foo실제로 원하는 diff를 얻을 수 있습니다 . msysgit 1.9.4 / Windows 7 x64로 시도하면 얻을 수 fatal: unable to read 0000000000000000000000000000000000000000있습니다. -R내가 없으면 git 1.7.9.5와 동일한 오류 메시지가 표시되지만 1.9.4에서는 fatal: master:foo: no such path in the working tree.
작업 트리를 특정 분기 이름과 비교하려고하므로 다음을 원합니다.
git diff master -- foo
이 형식의 git-diff에서 온 것입니다 (git-diff 맨 페이지 참조)
git diff [--options] <commit> [--] [<path>...]
This form is to view the changes you have in your working tree
relative to the named <commit>. You can use HEAD to compare it with
the latest commit, or a branch name to compare with the tip of a
different branch.
참고로, 작업 트리의 모든 것이 아니라 스테이지 한 내용의 차이를 볼 수 있는 --cached(일명 --staged) 옵션 도 있습니다 .
git diff [--options] --cached [<commit>] [--] [<path>...]
This form is to view the changes you staged for the next commit
relative to the named <commit>.
...
--staged is a synonym of --cached.
또한: git diff master..feature foo
git diff foo master:foo나를 위해 디렉토리에서 작동하지 않기 때문에 .
git diff branch1:foo master:foo
git diff항상 stackoverflow.com/questions/5256249/git-diff-doesnt-show-enough/…를