tags:

views:

52

answers:

1

Hi all,

sometimes i have the situation that i discover a bug and correct it and then commit the changes. This commit can be cherry-picked in all affected branches, a feature that i really like.

But it turns out to be tedious ( check out affected 5-10 branches, pick commit ) or error-prone ( cherry-picking when working on that branch - sometimes days/weeks later )

Is there a possibility to automate the cherry-picking into multiple branches? Writing a script iterating the affected branches seems possible, but the set of affected branches ( and the branches themselves ) changes permanently -

Best Wendy

+3  A: 

Short version of the answer: you should not cherry-pick this bugfix. You should merge it. All you need to do is make sure you commit the fix to a branch started from a common ancestor of all branches which need the fix, and then merge it into each of them. This is much better than cherry-picking, because it doesn't make duplicate commits all over your repo, and if you later need to merge two of the branches which received the fix, there won't be problems. The general principle here is a maintenance branch, started from some older version which you're maintaining, and merged from there into all later maintained versions and releases.

For more detail, and related philosophical advice, see my answer to this question about cherry-picking, as well as the comments to it and the links I supplied in those comments!

Jefromi