Should we have the ability to enable remote push per branch? I don't think we want to push all the branches all the time, some of them can no longer exist on the remote repo.
What to do when a branch has been removed on the remote repo? Should we remove it on the mirror or only disable remote push on it?
What is a FF push is not posible? Should we try to merge the remote branch and push again or only let the user know about it and provide some guidelines to do this through the terminal?
The existing "Mirror Repository" feature is for when the original repo is somewhere else, and GitLab should be the mirror. This issue is about the case where the original repo is on GitLab, and the mirror is somewhere else. The intention is to keep the remote repo fully up to date with any changes to ours, so if a branch is deleted from the repo repo, we just push it again. When it is deleted from ours, we delete it there as well.
The only exception is when the remote branch has been updated, in which case we can't push to it without losing commits. In this case we shouldn't update it, and we shouldn't delete it.
If the fast-forward update is not possible, we can do like we do with "Repository Mirroring" now, and show a tooltip like "The remote branch has diverged and could not be updated." We can basically use the same logic and text, but just flip the "remote"/"local" around.
@mpapis Do you have any suggestions related to this feature? What do you think would be useful in your workflow? (I talked with Michał about this feature, a few days ago).
Small questions about this feature reserved for EE Version.
After the various controversies around GitHub , imagine that each can host its self instance gitlab keeping github as a mirror. Which could give more users, more lift , thus more visibility and more love for gitlab.
I think many research this function to get rid of github.
that's why I think this feature could push to the CE version.
@grzesiek most important push to more then one repository.
I can not agree with @DouweM about removing remote branches, I think it would be better as option, for me the remotes are not just a backup, they are also the archive of all the past, so I would like the remote branches even if we remove some of them on GitLab.
@mpapis To truly mirror repositories, we need to keep the branches synced as well. I want to understand your use case, why would you remove some branches from GitLab if you wanted to keep them? Why not just not remove them?
@DouweM it depends if the purpose is to mirror or backup/archive, for me it's more about archiving information, my project has installation infrastructure based on github branches, I do not want any of the branch removals reflect users that use the infrastructure, if there is something very wrong with the branch in question - I would remove it manually from github.
another question would be if we can force push diverging branches if the push to GitLab was also pushed.
for master we do not do that, but when working on different branches it might happen that we amend the last commit and we force push, I would expect a forced update to the remotes too.
another question would be if we can force push diverging branches if the push to GitLab was also pushed.
Good point. Overwriting remote branches (except for master) in the case of a forced push is valid.
I think that in a next iteration, we should allow more control of the delete/override behavior, so we can disable propagation of branch deletion, and enable overwriting of branches other than master.
I got real life use case, I will be moving rvm to gitlab, we have installation infrastructure based on github - so with the hook I can move the code without changing the installation code and all the past installation using the old code pointing to old installation will still work as expected.
@inem@mpapis I got a repository syncing back to github too (I've created a personal token there to authenticate and be able to push), and I did that so people who forked or used my project before keep getting updates until they decide to start contributing using gitlab.
@inem We just started using this for our Infrastructure runbooks. We want them to be public, so they're hosted here, but the information in them is needed when GitLab.com is down, so we push to the remote mirror on dev.gitlab.org so they're always available.