The problem here is that you can't do this in the general case. Suppose Alice changes a particular file, then Bob changes it - including parts that Alice changed - and finally Alice changes it again. How do you combine Alice's two diffs into a single diff? If you take them as two patches, the second simply won't apply without Bob's patch being applied first! But you also can't simply diff the final state against the original, because that will include Bob's changes.
If you prefer an example with git operations, this is like doing an interactive rebase, and just deleting random commits. Sure, sometimes it'll work, but sometimes it'll just completely fail, because one of those commits depended on one of the ones you took out.
So, I know you said you don't want individual commit diffs, but that's all you can really hope for:
git log -p --author=Alice
Or if you're really desperate for a single diff, this will get it for you, but only in the cases where there's no patch interaction like I mentioned above:
git checkout -b temp first_commit
git log --reverse --pretty=%H --author=Alice first_commit..second_commit |
while read commit; do
git cherry-pick $commit || exit
done
# or if you have a new version of git, cherry-pick works with multiple arguments:
# git cherry-pick $(git log --reverse --pretty=%H --author=Alice first_commit..second_commit)
git diff first_commit temp
This does really require operations in the work tree, because there's absolutely no guarantee that any of the patches will apply once a commit has been skipped. You just have to try and see.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…