I have a git repository in which I usually work on two branches, a
git diff base..public > pub.diff
git diff base..private > private.diff
interdiff pub.diff private.diff
\ \ \
git diff D'..M
is about comparing two endpoints, not ranges
This might not be possible (
git diff will not detect were those changes came from).
You could try using
$ git log -p --no-merges --first-parent D'..M
-pgives you a diff (patch) for the commits listed
--no-mergeswill exclude merges from the list
--first-parentwill only follow the first parent (the one you merged into e.g.
D'..Mas explained in git revisision will
Include commits that are reachable from
<rev2>but exclude those that are reachable from
A different approach would be to follow @torek's suggestion and create a temporary branch,
cherry-pick all the commits onto it and then look at the diffs from this branch.
git cherry-pick is not able to skip commits when specifying commit ranges you would first need to get a list of commits for cherry-picking (Here Option A is useful)
$ git log --no-merges --first-parent D'..M --pretty=format:%H
--pretty=format:%Hwill print all the commit hashes in long form
Create the temporal branch (which needs to have the correct starting point)
$ git checkout -b temp D'
And then cherry-pick those commits manually or try using this command
$ git log --no-merges --first-parent --reverse --pretty=format:%H | git cherry-pick
--reverseis used to reverse the order of commits printed (oldest to newest instead of the other way around)
This approach might fail if commits are based on changes which were merged in