Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import repository from git to gerrit

Tags:

git

gerrit

I have two questions about Gerrit:

  1. 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:

    1. Copy existing bare Git directory to Gerrit and then add it to database. Is that a safe method?

    2. Push all commits from my local repository to gerrit repository.

  2. How to revert repository from Gerrit to original Git format? Is it required to remove Gerrit's special */for/* branches to do that?

like image 394
DEgITx Avatar asked Feb 09 '13 15:02

DEgITx


People also ask

How does Git work with Gerrit?

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.


1 Answers

First of all: There is no special "Gerrit format". Gerrit works with regular git repositories.

  1. 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.

  2. 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.

like image 113
helmbert Avatar answered Sep 17 '22 02:09

helmbert