0

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

miro ring
  • 13
  • 2

3 Answers3

0

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.

technophyle
  • 7,972
  • 6
  • 29
  • 50
0

C' contains the same textual changes as C because that's how cherry pick works. So clearly if you git diff C C', there will be no visible changes because they both have the exact same code. In this situation, I suggest merging master into dev instead of cherry picking. This will help avoid merge conflicts.

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
0

On a Pull Request or a Merge Request (of Gitlab), comparing the source branch (develop in your case) with the target branch (master) is equivalent to

git diff master...develop

instead of

git diff master..develop
# Or
git diff master develop

With 3 dots ..., it's comparing b with D'. b is the merge-base (or fork-point) of master and develop.

With 2 dots .. or no dots, it's comparing D and D', which is what you expect.

From the view of a Pull Request or a Merge Request, it focuses on the changes which have been made since the fork-point, the contribution on develop.

Here is a Gitlab issue that explains the situation.

ElpieKay
  • 27,194
  • 6
  • 32
  • 53