gitcherry-pick

Do you know why this cherry-pick makes code diff?


I made some commit (C and D) in master branch for hotfix. After this, I cherry pick these commit in develop branch. I guess, If I make Pull Request (base is master, compare is develop), there is no code diff. But there is code diff which includes C and D code changes. Can you explain why there is code diff...??


Solution

  • Cherry-picking replicates the code changes, so the exact same code changes and commit messages would be applied but the commit hashes would be different because they're new, replicated commits.

    From documentation:

    Given one or more existing commits, apply the change each one introduces, recording a new commit for each.