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:
My question is what is the difference and what kind of problems I might have going with either one?
git merge master will update your current branch with the changes from your local master branch, the state of which will be that of when you last pulled while on that branch.
Properties of the Gitflow hotfix No feature enhancements or chores are allowed on the Gitflow hotfix branch. The hotfix branch merges into both master and develop branches when its lifecycle ends. The hotfix branch is deleted after it is merged or rebased into master and develop branches.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With