3 ms·
What I need is some way to deal with my 6 month old release branches that are completely incompatible with the current develop branch. When I make a fix on the
by Aeolun 5y ago
What I need is some way to deal with my 6 month old release branches that are completely incompatible with the current develop branch.
When I make a fix on the 6 month old branch, I have to manually cherry pick it to the current release and develop branch, and by cherry picking I lose all association between those three commits now ostensibly containing the same changes (though not really, because conflict resolution makes all of them different).
There must be a better way.
- eru 5y agoWell, here's a technique you can sometimes use: Start a feature branch off from the last common ancestor between your branches of interest. Make your commit against that. Then merge that feature branch into the old release branch, current release branch and feature branch. You might still have to do lots of conflict resolution, but at least this way you can preserve the associations in a form legible to git. This works a bit better, if you can regularly merge your release branches back into your development branch, since then the last common ancestor will be exactly the release branch.
- Aeolun 5y agoThis sounded great, but then I realized that we have a PR based workflow. My issue with that was that I cannot resolve conflicts for all three target branches on the single branch. It works fine locally, when you just run merge and fix conflicts in one action. But I need to push my branches to bitbucket/github to go through a review process, so you can’t stay with one branch. I guess I could run the merge, and resolve the conflicts locally, then push a separate branch to make a PR with for each target with the original+merge commit inside.
- eru 5y agoI actually use this technique on a PR based workflow. In BitBucket, you can make multiple PRs from the same branch. > I guess I could run the merge, and resolve the conflicts locally, then push a separate branch to make a PR with for each target with the original+merge commit inside. Yes, that's basically what I do. Though most of the time, I don't need to bother with the merge commit, because I only do this dance to get something into both master and release, but they haven't diverged too far, yet.
- Aeolun 5y agoHaha, yeah, the reason it is a problem is because they’ve diverged so far. If you can still merge the same changes to both branches you are home free. Checking today and there’s differences in 2.5k files (out of 3.5k maybe?). To be fair, a lot of that is cleanup, but still.
- cerved 5y agoyes basically
- brandmeyer 5y agoThe `-x` argument to cherry-pick helps a little bit with traceability. It adds a line to the commit message that refers back to the original commit by its SHA. If you decide that the way things were done way back when on the release branch isn't quite how you want to proceed in the future, you just amend the message to reflect the additional changes. The SHA is still there to reach back and see how things were done in the first place.
- Aeolun 5y agoOh, sweet, that is indeed helpful.