Marti Markov
Marti Markov

Reputation: 766

Git hotfix merging to master and master to develop

If I have two branches: master and develop. All the releases come from the master branch and all features are developed from the develop branch.

If I create a hotfix branch from master and then merge it back to master I think I have two options from there:

  1. Merge to master and then to develop
  2. Merge to master and master to develop

My question is what is the difference and what kind of problems I might have going with either one?

Upvotes: 8

Views: 4451

Answers (1)

Matthew Hallatt
Matthew Hallatt

Reputation: 1380

In theory, there should be absolutely no difference.

Once you've merged the hotfix branch in to master, master and the tip of the hotfix branch are at exactly the same point.

So whether you merge master or hotfix in to develop, you end up with the same outcome.

Having said that, I personally think you should go with option 1.

With master being for release only, I feel you should never merge from master back in to develop, only from develop in to master.

Keeping this flow one way helps keep things in order. You know in your head you can't make any changes directly on master, as you won't have a way of getting them back in to develop. You either have to hotfix and merge in to both, or create a feature on develop.

Hope that helps!

Upvotes: 10

Related Questions