I'd like to compare two branches that have diverged significantly. I would also like to limit my comparison to a particular subdirectory where the files were moved in only one of the branches.

Example layout:

branch-a
└── sub
    ├── file1
    ├── file2
    └── file3
branch-b
├── file2
├── file3
└── file4

Running git diff -M branch-b from branch-a correctly diffs the files, but it includes all changes, not just those in sub. I've tried using --relative, but that seems to prevent move detection.

有帮助吗?

解决方案

I figured it out:

git diff branch-a:sub branch-b

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top