We have a master and a production branch. The master branch contains current developments while the production branch contains the stuff that is running on the server. From time to time, there is an important bugfix that has to be applied to both branches.
Currently we are just cherry-picking the commit after creating it on the master branch. But this sometimes creates merge conflicts when we are merging the branches. Are there alternatives?
You can create a new branch (let’s call it
bugfix-a) at the merge base ofmasterandproductionApply your bugfix in that branch
Then, merge this new branch to both master and production:
That way you should be able to merge master and production at a later date and Git will be clever enough to figure out which commits to pick.
(Monotone – yes, it’s not Git – calls this workflow daggy fixes)