Gerrit: Working with already existing git repos
I want to introduce gerrit into my soft dev environment. The issue is that I already have existing git repos... I was able to install gerrit and get a copy of already existing repos by executing following command: git clone --mirror ssh://some_machine/path/to/favourite/project.git project.git
But now, I need to sync the changes back to original repos. Is there a way to do it or do I need to move completely to new repos handled by gerrit and block already existing git repos so that developers won't be able to check stuff into them?
Sorry, very new to gerrit...
Running two parallel repositories where people commit code is painful since someone needs to keep them in sync. As long as the Gerrit instance is for playing around and no real commits are made there you're fine, but if people commit real work there you should make up your mind on where you want to go.
To reconcile two repositories that have diverged, clone one of the gits, add the other repository as a new remote, merge from the tip of the branch, and push back. The following example show how to copy branch branchname from gerrit.example.com to git.example.com.
$ git clone ssh://git.example.com/some/project $ cd project $ git remote add gerrit ssh://gerrit.example.com/some/project $ git fetch gerrit $ git checkout origin/branchname $ git merge gerrit/branchname $ git push origin HEAD:branchname
You'll obviously have to resolve any conflicts that resulted from the merge. Repeat as necessary for additional branches.
The example will create the merge commit on a detached head. If you like, you can create a named branch first and merge into it.