I have two questions about Gerrit:
How do I convert or import an already existing Git repository into Gerrit's format? There were a lot of commits without Gerrit control, I want to simply push those commits into a Gerrit project.
I see two ways to do it:
Copy existing bare Git directory to Gerrit and then add it to database. Is that a safe method?
Push all commits from my local repository to gerrit repository.
How to revert repository from Gerrit to original Git format? Is it required to remove Gerrit's special */for/*
branches to do that?
Gerrit is a web-based code review tool, which is integrated with Git and built on top of Git version control system (helps developers to work together and maintain the history of their work). It allows merging changes to Git repository when you are done with the code reviews.
First of all: There is no special "Gerrit format". Gerrit works with regular git repositories.
Create a new project in Gerrit (without an initial commit). Add the created repository as a remote to your existing repository and simply push. You can configure Gerrit to allow direct pushing into the repository (bypassing review), allowing you to import the entire repository.
Alternatively, if you have direct access to Gerrit's repository location (e.g. via SSH or on the local filesystem), you can just push directly into the repository (whereever Gerrit created it), bypassing Gerrit entirely. You'll need to flush the Gerrit caches afterwards, however, for Gerrit to notice that the repository HEADs have updated.
As said, there is no "Gerrit format". Just clone your repository from gerrit, and all is well. You don't need to worry about any special branches.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With