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?
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!
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.