Scenario: a repository with completely unrelated history. For instance. from different remotes that do not have a common git history. (This usually happens in git subtree scripts.)
Is it possible to use cherry-difference between the two commits, even if they have no common history? (And active commit has no common history with either of these two)
I tried this (in a subdirectory with the -X subtree=sub/dir option):
git cherry-pick -X subtree=vendor/package aaa/aaa..bbb/bbb
Without a subtree, this would be simpler:
git cherry-pick aaa/aaa..bbb/bbb
Where aaa / aaa and bbb / bbb are two commits with disabled history.
Unfortunately, this does not work: aaa / aaa..bbb / bbb does not read as diff, but something else.
You can show the same thing with git show aaa/aaa..bbb/bbb , which is very different from git diff aaa/aaa bbb/bbb . For instance. if both have the same files, then git diff will be empty, but git show a..b will only show b, but not.
Note. My personal use case is with a subtree background. I mention this to avoid using artificial use, when people usually start discussing the validity of a use case instead of the actual question.
The ideal answer will first consider the general case, and then turn to the subtree case.
source share