Background
I have a public repo on GitHub that stores the latest updates of my project.
┌───────────────┐ ┌───────────────┐ ┌────────────────┐
│ │ │ │ │ │
│ GitHub │ Public │ GitHub │ Private │ GitLab │
│ │ contrib│ │ contrib │ │
│ Public fork ◄────────► Public repo │x─────────x│ Private mirror │
│ │ Create │ │ Cannot │ │
│ Downstream │ PR │ Upstream │ create PR │ Downstream │
│ │ │ │ (push/pull│ │
└───────────────┘ └───────────────┘ via local└────────────────┘
machine)
The contributions are done publicly and privately:
- Public contributions are trivial – just create a PR on GitHub.
- Private contributions are needed for some changes whose review or work-in-progress details shouldn’t be revealed. For such changes, there is a private mirror on GitLab. I periodically sync the GitLab mirror with the public repo and work on MRs there.
As I said, I have a GitLab mirror. It means that I do not make any changes to the main branch there, I only pull the changes from upstream. I know that there are things like bidirectional mirror which can probably be used in my case but is usually advised against doing for CAP theorem as so on.
As a result, the workflow for private contributions (pushing the changes from the private mirror on GitLab to the public repo on GitHub) is as follows:
-
In the private mirror on GitLab:
- a. Sync the main branch with upstream
- b. Create a new branch, make changes, and create an MR
- c. Have the changes in the MR reviewed and approved
-
Once the work on the MR is finished, I do the following:
- a. Close the MR on GitLab
- b. Pull the branch with changes on my local machine
- c. Push the branch upstream to my public repo on GitHub via the local machine
- d. Create and merge the PR on my public repo on GitHub
My questions
There are the following things that I don’t like about my workflow:
- The MRs on GitLab are closed. I cannot merge them, because the GitLab repo is a mirror (I explained the reasons earlier). Can MRs be dealt with in a better or cleaner way?
- The step 2c (“Push the branch upstream to my public repo on GitHub via the local machine”) is done manually. Can and should I automate this process? If yes, how can I do it?