Symfony-docs: Bad merge from 4.1 to 4.0

Created on 21 Jun 2018  路  3Comments  路  Source: symfony/symfony-docs

Hi guys!

Recently (not sure exactly when/how), the 4.1 branch was merged into the 4.0 branch. So, we need to identify when this happened, and how to fix it.

I talked with @nicolas-grekas, and he thinks that bad commit was sha: 9e860a1ff1447eebb99e39c23e5510534078387c and that we should rollback to one of its parents: sha: d6b29968b27fb1034d35159fb434dfc90c9e1680

I'm hoping to find out if a few other people agree or disagree (I will look tomorrow). IF this is the correct commit, then we can:

A) Merge current 4.0 up to 4.1/master
B) reset hard 4.0 back to sha: d6b29968b27fb1034d35159fb434dfc90c9e1680 & force push
C) manually add the missing commits to 4.0

cc @teohhanhui

Most helpful comment

What I did to resolve a similar issue in API Platform:

  1. Merge the messed up branch into the newer version branches and master.
  2. git checkout -b a feature branch from the messed up branch - in this case 4.0.
  3. git reset --hard to the clean parent commit - d6b2996 in this case.
  4. git cherry-pick each commit that should be included, and manually resolve conflicts if necessary - it will hopefully be minimal, and at least the conflicts would make sense since we're moving forward in time.
  5. git push to a feature branch and open an unmergeable PR for review purposes - also to make sure that Travis CI build is green.
  6. git diff or similar to create a patch/diff file since the clean parent commit up to current HEAD.
  7. git checkout -b a new branch from the current HEAD of the remote branch - 4.0 in this case.
  8. Make sure the working directory is clean.
  9. git apply or similar to apply the patch/diff file.
  10. git commit and git push to another feature branch. This time it's mergeable so open a PR and get it merged.
  11. git merge -s ours into the newer version branches and master. We don't need an actual merge as all the same contents should already be in those branches.
  12. Profit???

Note that there is no force pushing involved at any point.

All 3 comments

What I did to resolve a similar issue in API Platform:

  1. Merge the messed up branch into the newer version branches and master.
  2. git checkout -b a feature branch from the messed up branch - in this case 4.0.
  3. git reset --hard to the clean parent commit - d6b2996 in this case.
  4. git cherry-pick each commit that should be included, and manually resolve conflicts if necessary - it will hopefully be minimal, and at least the conflicts would make sense since we're moving forward in time.
  5. git push to a feature branch and open an unmergeable PR for review purposes - also to make sure that Travis CI build is green.
  6. git diff or similar to create a patch/diff file since the clean parent commit up to current HEAD.
  7. git checkout -b a new branch from the current HEAD of the remote branch - 4.0 in this case.
  8. Make sure the working directory is clean.
  9. git apply or similar to apply the patch/diff file.
  10. git commit and git push to another feature branch. This time it's mergeable so open a PR and get it merged.
  11. git merge -s ours into the newer version branches and master. We don't need an actual merge as all the same contents should already be in those branches.
  12. Profit???

Note that there is no force pushing involved at any point.

Fixed! @teohhanhui I actually did ultimately do a force push. It has obvious downsides, but was a bit simpler. And, fortunately, the force was only on the 4.0 branch, which does not have many PR's against it. Things are a bit more forgiving on the docs :)

Well, you must remember you have many forks of the repository (and of course the local clones). Now they're all screwed. 馃槀

Was this page helpful?
0 / 5 - 0 ratings