简体   繁体   中英

git cherry shows a new commit as cherry-picked when an identical commit was cherry-picked in the past

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?

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 of git cherry is correct.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM