magicstone-dev / c4-tools

Maintaining community-driven forks using the Collective Code Construction Contract (C4)
GNU General Public License v3.0
8 stars 1 forks source link

Problem: Resolving upstream fetches that have conflicts may result in broken build #11

Open weex opened 3 years ago

weex commented 3 years ago

If fetching upstream requires opening a pull request so that conflicts can be resolved, and such conflicts are resolved as follows, then a merge is completed without letting CI run.

This is a specific example of what Github recommends for resolving conflicts using command line.

git checkout -b mastodon-main main
git pull https://github.com/mastodon/mastodon.git main
git o mastodon-main

Then commit to finish merge... (don't do this)

git o main
git merge --no-ff mastodon-main
git push origin main
weex commented 3 years ago

The way to solve this is not to create the pull request initially. Instead, follow the same instructions as above except the second stanza should use an integration branch like upstream-integration instead of main. Then when that branch is pushed on the last line, it can be used to create a PR with no conflicts.

So the second stanza becomes: (do this)

git o upstream-integration
git merge --no-ff mastodon-main
git push origin upstream-integration
weex commented 2 years ago

To clarify, here's what has worked twice:

git checkout -b mastodon-main main
git pull https://github.com/mastodon/mastodon.git main

Fix merge conflicts and git commit to finish that merge.

git o upstream-integrationX
git merge --no-ff mastodon-main
git push origin upstream-integrationX

where X is an unused number. If the branch upstream-integration is deleted after push, and created from our main at the beginning, then there's no need to keep creating new upstream-integrationX branches.