3

I have 2 separate develop branches in Git, develop1 and develop2. These 2 branches have a common ancestor, commit C1 on master. These 2 branches contain 2 product releasecycles will will be joined in about 6 months (both merged into master).

Before the big merge in 6 months, branches develop1 and develop2 will be kept separate, no merging between develop1 <-> develop2 will be done.

However, some changes (like project structure, script changes) will be done on both branches.

My idea is to perform these changes on develop1, then cherry-pick them to develop2.

My questions:

  1. Is this wise to do?
  2. Will this result in problems later when performing the big merge?

The reason I'm asking this is because I've read that cherry-picking may result in problems because new commits are created.

One reference listing the possible problem: http://blog.founddrama.net/2013/07/git-cherry-pick/

Bossk
  • 619
  • 6
  • 20
  • 1
    IMO, whether you use cherry pick or manually add commits to d2, it is going to be a different commit, hence you would run into problems (if at all). I am hoping the anticipated conflicts should not be too hard to fix. – Sameer Naik Sep 07 '15 at 06:41

1 Answers1

1

I ma always referring to the same issues with cherry-picking (as in "git - cherry-pick - HOWTO / WHYTO")

The second issue is not relevant here, as you are chrry-picking only commits that work on their own and are tested/validated on the second branch well before they are merged on master.

But the first one can be an issue when develop1, then develop2 will be merged to master. The merge itself should be fine.
But, as explained in "Git cherry pick and datamodel integrity", a change will appear twice in the history of a merged commit.

If possible, once develop1 is merged to master, I would rebase develop2 on top of an updated origin/master, before merging develop2 back to master: that would detect identical commits and not apply them twice.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283