Bitbucket : Workflow for hotfix...

Michael Phipps September 13, 2017

Every time I try to do a hotfix - it goes pearshaped - I need to understand how to do it properly.

Scenario:
I have 2 branches.
Master contains the current production code
Develop contains the code I am working on.

I will be part way through working on something in the develop branch, and I'm told "Drop everything - there's a problem with the production code"

So - I commit and push what I am working on in the development branch
I create a hotfix branch
In my working directory I git fetch && git checkout hotfix

I fix the problem.  

I commit and push the hotfix.  

What pull requests do I now do to merge the hotfix to master and development?

1 answer

1 accepted

1 vote
Answer accepted
Olmo Buining April 16, 2019

One good resource that I've been using for years now: https://nvie.com/posts/a-successful-git-branching-model/

If helps a lot with the flow of how we should merge. As far as I understood, you are creating the hotfix branch from develop, while a hotfix should always be made from master. and then merged back into both: master and develop.

I hope this helps!

Michael Phipps April 16, 2019

Thanks for posting an answer!  It's been a few years since I asked this question.  I found a solution a while back  that works well for me and neglected to update this!  

I now follow the Gitflow Workflow https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow

The hotfix works pretty much exactly the way you describe.  I create a hotfix branch from master, do the fix, and then merge the hotfix back into master and develop.

Jimmy Seddon
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 17, 2019

I 100% agree with @Olmo Buining that branching strategy has been my go to for a number of years as well, and it has been very successful.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events