Reputation: 11425
I have a mirrored repo ("mirror") that copies some "prime" repository. GitLab makes this easy, and will poll the prime for updates every hour.
I made a commit to my mirror (added a file for use with pre-commit), which causes polling to fail. What I wanted was my mirror to still stay in sync with the prime but with that commit applied on top.
Is there a way to make mirrors update and rebase instead of just git remote update
, which will fail since my mirror has a commit that my prime does not?
Edit: It looks like GitLab says it doesn't support this functionality, though it seems like it would be an easy add.
Upvotes: 3
Views: 3027
Reputation: 2705
Once you commit to a mirrored repository, the branch is considered diverged. New commits mirrored from upstream can no longer be applied cleanly to your mirror.
The only potential solution I can recommend is to keep the main mirrored branch alone (probably master). Then, create a new branch where you apply your change. Periodically rebase this branch against master to get the latest changes, reapplying your changes on top. The workflow would be something like the following:
git checkout master
git pull origin master
git checkout my_other_branch
git rebase master
git push my_other_branch -f
Upvotes: 6