简体   繁体   中英

git cherry-pick SHA1 ID

I am still new to git and I came across this cherry-pick command. Lets say I cherry-pick a commit (lets call it CA) from devel branch to the master branch and they now both have different sha1 id if what I interpret is correct.

So my question is, if later I want to check the "differences" between devel branch and master branch using git cherry to find out which commits are eventually pushed to master and which does not, but since the commits (CA) I cherry-picked just now will have a different SHA1 id so when I execute git cherry master devel what does it tell me? Does it tell me CA is pushed to the master ? Or does it tell me CA is NOT pushed to the master since they don't share the same SHA1 ID?

git cherry uses git patch-id to compare the commits. Two commits introducing the same change will have the same patch ID, and git cherry will say that the change already exists in upstream by prefixing the commit with a hyphen/minus (-) sign.

So in your case git cherry master devel would output the commit you cherry-picked prefixed with a hyphen/minus (-), indicating that the change it introduces already exists in master. Commits introducing changes that do not exist in master would be prefixed with a plus sign (+).

This is explained in man git-cherry .

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