Long-running Release Candidates
tl;dr - Me neither, I guess.
Do either of these situations make you sad?
If so, you don’t like long-running branches and/or merge conflicts.
Options
Avoid Conflict
Conflicts are the result of two commits changing the same thing differently. As in life, the only way to avoid conflict is for one of the commits to give up and drive off a cliff.
There is no avoiding conflict. -Kurt Cobain
Cherry-Pick
Maybe you could git cherry-pick
commits from the release branch into develop.
That way you can build on them before they make it to develop!
That’s a stupid idea. -Gandhi
Maybe I’ll write another blog on this later, but the point is cherry-pick is Git’s version of copy/paste. You wouldn’t want your mom to see you do that, would you?
Aside from that, what’s the point in keeping commits in the release branch if you’re just slurping them into develop willy-nilly?
Another Crazy Idea
What about rerere
? That’s not a cat on my keyboard, it’s a real
thing.
When you finish a feature, if there’s a looming release branch that will soon land in develop, you could preemptively create any conflict resolutions for it. In psuedo-psuedo-code, it would be something like:
- finish feature
- git merge rc
- resolve conflicts
- rerere
- git merge –abort
This will result in nice new entries in .git/rr-cache/
even though you bailed
on the merge.
Share It!
Later, when the poor asshole responsible for merging the branches back together is ready to do so, he can ask everyone to share their rerere caches. Once he aggregates them in his dir, he can stroll right through the conflicts, automatically using resolutions written by the domain experts.
What if the release branch gets merged back into develop before the feature? -Thoreau
It’s OK. They work both ways. It doesn’t matter which lands first. In this case, the dev has the resolution already and can apply it.
Surprise Ending
As I started writing this, I looked back at the classic Gitflow page to draw inspiration for the diagrams. Then I noticed…
So, none of this matters.
Aside from that, what’s the point in keeping commits in the release branch if you’re just slurping them into develop willy-nilly? - Anonymous