Assume that there are two branches branch1 and branch2 and there is a test.txt on both the branches with the following line "opt:true".
Change the value from "true" to "false" on both the branches.
On branch1, change the value from "false" to "true" and commit it.
"git cherry branch2 branch1"
shows that the latest commit is not cherry-picked to branch2.
+ dc703edb4cf0f90fa1b5294cc5bea5c63c849229
On branch1, change the value from "true" to "false" and commit it.
"git cherry branch2 branch1"
shows that the latest commit is cherry-picked (though it is not cherry-picked) as there is an identical commit already on branch2.
/+ dc703edb4cf0f90fa1b5294cc5bea5c63c849229
/- 9d767893962c0dd0d957e2c038bb2ef06df2fee3
Is there a way to git the true list of commits on branch1 that are not cherry-picked to branch2?
git cherry
doesn't show you what has been cherry-picked, git doesn't record that information. It shows you which commits are equivalent and which are not. It's basically a commit-by-commit diff.The purpose of
git cherry
is to let you know what commits have been applied or will yet be applied if you were to rebase. In that sense, the output ofgit cherry
is correct.