user1238193
user1238193

Reputation:

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 cherryto 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?

Upvotes: 0

Views: 1257

Answers (1)

jsageryd
jsageryd

Reputation: 4633

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.

Upvotes: 1

Related Questions