According to its man page, git cherry
does some testing to determine if a commit should be cherry picked into another branch:
The equivalence test is based on the diff, after removing whitespace
and line numbers. git-cherry therefore detects when commits have been
"copied" by means of git-cherry-pick(1), git-am(1) or git-rebase(1).
I want create a script to further minimize the list of cherry-pick candidates by removing all commits that would change only a certain file.
E.g. if cherry picking commit 1 with changed files A, B, C into my branch would change only file A while B and C would already contain the changes, I want the script to remove the commit from the list of candidates.
To put it another way, if I cherry-picked a commit as suggested by git cherry
, and the resulting commit would change only file A, and no other files, I would want to remove it from my list.
Is there an easy way to get this information out of Git?