Make a git cherry fence in several branches

sometimes I have a situation where I find an error and fix it, and then commit the changes. This fixation can be selected by cherries in all affected branches, a feature that I really like.

But it turns out to be tiresome (check 5-10 branches, choose a fix) or error-prone (choosing a cherry when working on this branch - sometimes days / weeks later)

Is it possible to automate the collection of cherries in several branches? Writing a script to iterate over the affected branches seems possible, but many affected branches (and the branches themselves) are constantly changing -

Best wendy

+3
source share
1 answer

Short answer: you should not cherry-pick this fix. You must combine it. All you have to do is make sure that you fix the patch for the branch that started with the common ancestor of all the branches that need to be fixed, and then merge them into each of them. This is much better than picking cherries because it does not make repeated commits throughout your repo, and if you later need to merge the two branches that got the fix, there will be no problems. The general principle here is the service branch, started with some old version that you support, and merged from there into all later versions and releases.

For more details and philosophical advice related to it, see my answer to this question about choosing a cherry, as well as comments on it and the links that I provided in these comments!

+6
source

All Articles