2

I noticed this question about rebase vs merge, but none of the answers there really gave me a solid feeling of knowing what to do about my own situation.

The scenario. Lets say there are 2 branches:

  • master: branch currently living on production
  • develop: non deployed branch developers do feature work off of

If a change/hotfix if applied directly to master in order to resolve a critical production issue, what is the best way to get the develop branch synched back up with this change? What are the tradeoffs between:

  • merging master into develop (squashing into 1 commit)
  • rebasing develop onto master

Does the answer to this question depend on the number/extent of the hotfix applied? (1 hotfix commit vs 15 "hotfix" commits).

Cumulo Nimbus
  • 8,785
  • 9
  • 47
  • 68

2 Answers2

2

The answer is not depend on the number of hotfix but the situation you used.

For your situation, develop branch is used for all developers, so you’d better merge master into develop and not use rebase. And other developers just need to pull the merged commit from remote develop branch.

Rebase is mainly use the branch is a private/local or at least other developers not use it recently. If you rebase develop branch onto master, this will make other developers work in mess.

Marina Liu
  • 36,876
  • 5
  • 61
  • 74
0

the linked answer lists all the tradeoffs just fine.

In the end it is an opionated case by case decision. This 'special case' might be opinionated even more.

my intuitive OPINIONATED recommendation would be to merge master into develop as to not break anything or alter the branch..

Daij-Djan
  • 49,552
  • 17
  • 113
  • 135
  • To me it seems the linked answers mostly discuss the merging of feature/develop branches into master and not really the other way – Cumulo Nimbus Jun 29 '17 at 15:23
  • It details merging vs. rebasing. What branches are there doesn’t change the techniques or the answer – Daij-Djan Jun 29 '17 at 15:50