Question

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.

Was it helpful?

Solution

I figured it out:

git diff branch-a:sub branch-b

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top