I work with other Software Engineers on a web app product. Also, the source code is hosted on GitHub.
Recently, there was an introduction of a Continuous Integration procedure enabled by a script written as a yml
file and GitHub Actions.
After every Pull Request on GitHub, the CI script checks if the new code is breaking the application or if everything goes well. The construction of the dependency tree is a specially delicate part of the process. Hence, the dependencies used in the source code need to be the same declared on the CI's "build recipe".
A problem we have is that sometimes the main
branch is getting updated and evolving while the Pull Request has not been approved yet. This means the PR is behind main
branch.
By definition, the CI build script is not going to work under such conditions because the PR might have an older version of it while main
branch has a newer/current version of the project. As a consequence, for the CI to work well PRs need to always be on top of cutting-edge main
.
The way I usually solve this is by going to the PR's branch, pulling into the PR's branch from origin/main
and doing a rebase of local commits. Sometimes, merge conflicts will arise and I will need to solve them. It works. If the PR becomes obsolete again, I can do multiple iterations of the interactive rebase pulling from the latest remote main
. Since I am changing the order of history, it will probably be necessary to force push the changes when pushing them.
Ok.
Other members of the team prefer a different approach. They prefer to locally merge the latest main
on the local PR branch.
Apparently, the team treats both processes as "equivalent" and open to "personal preferences".
However, I am not sure about this claim technically speaking.
Thus, I would like to ask:
0 - What is the correct way to deal with Pull Request updates concerning an interface with a Continuous Integration script: rebase or merge?
1 - Is merging locally equivalent to the interactive rebase approach?
2 - Is merging locally also going to create an obligation for force pushes?
3 - Pulling from main and doing an interactive rebase can be done multiple times. Is it possible to repeat multiple times the merge procedure?