Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git diff different directories across branches

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.

like image 237
JRideout Avatar asked Oct 21 '13 19:10

JRideout


1 Answers

I figured it out:

git diff branch-a:sub branch-b

like image 71
JRideout Avatar answered Sep 18 '22 11:09

JRideout