Reputation: 4451
Maybe my question is not well-formed.
The situation is this: we have 3 public branches: dev, qa, master.
I need to commit an urgent fix to the master
, but the dev
and the qa
branches are already ahead of the master
by a few commits.
What is the cleanest method to make a patch, and apply it to the master
branch, as well as to all the branches?
EDIT:
Since many comments suggested cherry-picking, I would like to emphasize that I haven't committed the fix yet. I want to avoid cherry-picking, so if there's a better way of doing it, I would be happy to hear (maybe commit the fix on the master
and then rebase qa
and dev
)
Upvotes: 1
Views: 1551
Reputation: 42058
You can create a hotfix branch that is merged off from master and then merged back into master and develop. You can read more about hotfix branches here:
May branch off from: master Must merge back into: develop and master Branch naming convention: hotfix-*
Hotfix branches are very much like release branches in that they are also meant to prepare for a new production release, albeit unplanned. They arise from the necessity to act immediately upon an undesired state of a live production version. When a critical bug in a production version must be resolved immediately, a hotfix branch may be branched off from the corresponding tag on the master branch that marks the production version.
The essence is that work of team members (on the develop branch) can continue, while another person is preparing a quick production fix.
Upvotes: 4