question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

git workflow suggestion for Bazel repo: avoid cherry-pick when prepping a new release

See original GitHub issue

Description of the problem / feature request / question:

It seems that that Bazel team’s current git workflow is: When a new release is almost ready, make a branch for that release; then, as necessary, cherry-pick last-minute fixes from master into that branch, until the release is done.

My org has a fork of Bazel with some changes of our own, and the cherry-picking makes it very hard for us to move from one version of Bazel to the next, because we can’t git merge. (At least, I think it’s the cherry-picks that are causing all the conflicts.)

I think that it might work better to turn your workflow around: When you have a change that needs to be in the upcoming release, first commit it to the release branch, and then merge (not cherry-pick) the release branch into master.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mmoreartycommented, May 31, 2017

Here’s a concrete example of the sort of merge conflicts that I’ve been getting. Try this — start at version 0.4.5 and then try to “merge” to get up to version 0.5.0, with no custom changes at all:

$ git checkout 0.4.5
$ git checkout -b mybranch
$ git merge 0.5.0

That’s a pretty simple series of commands, and I would think it would work; yet it results in merge conflicts in 36 files.

If you take a look at the conflict in CHANGELOG.md, you’ll see that git can’t resolve the “conflict”, because the 0.4.5 version has the description of 0.4.5; the 0.5.0 version has that plus the description of 0.5.0; and the merge-base has neither. If git merge was being used instead of cherry-picking, git would have been able to figure out what to do.

I did eventually figure out a workaround: I git merge twice. First, I git merge only up to the commit on master that corresponds directly to the corresponding head of 0.4.5; then I git merge again the rest of the way. That way, most of the changes that git sees in the first git merge are identical on both sides. Like this:

$ git checkout 0.4.5
$ git checkout -b mybranch
# merge only up to the master commit that corresponds to the head of 0.4.5:
$ git merge 8d635fc57
# resolve just one conflict. then:
$ git merge 0.5.0
0reactions
hlopkocommented, Jun 26, 2017

I guess we can close this issue now, feel free to shout at me otherwise 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

034 Avoid Multiple Cherry-Picks using Git Flow - YouTube
In this video we go through a simple release /dev/hotfix branching strategy based on git - cherry-pick and then show an alternative approach ......
Read more >
The case against `git cherry pick`: Recommended branching ...
Create a new feature branch directly from the main branch; Make changes on said feature branch; Test locally; When ready, open a pull...
Read more >
gerrit - Git at Google
-1,13 +1,15 @@ = Gerrit Code Review - Building with Bazel ... tools/version.py` script and provide the new version as parameter, e.g.: ----...
Read more >
Change log for 4.10.16
Changes from 4.9.0 · Components · New images · Removed images · Rebuilt images without code change · aws-cloud-controller-manager · aws-ebs-csi-driver.
Read more >
Gitiles - GerritHub.io
Git repositories on review.gerrithub.io ... repository of the code which runs the new CA's for AfricaGridAAROC/DevOpsAnsible playbooks that ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found