从git导入存储库到gerrit [英] Import repository from git to gerrit

查看:369
本文介绍了从git导入存储库到gerrit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于Gerrit我有两个问题:

I have two questions about Gerrit:

  1. 如何将已经存在的Git存储库转换或导入为Gerrit格式?有很多没有Gerrit控制的提交,我想将这些提交推送到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.

我看到两种方法:

  1. 将现有的裸Git目录复制到Gerrit,然后将其添加到数据库.那是一种安全的方法吗?

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

将所有提交从本地存储库推送到gerrit存储库.

Push all commits from my local repository to gerrit repository.

  • 如何将存储库从Gerrit还原为原始Git格式?是否需要删除Gerrit的特殊*/for/*分支来做到这一点?

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

    推荐答案

    首先:没有特殊的"Gerrit格式". Gerrit适用于常规git存储库.

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

    1. 在Gerrit中创建一个新项目(无需初始提交).将创建的存储库添加为现有存储库的远程目录,然后直接推送.您可以将Gerrit配置为允许直接推送到存储库(绕过审核),从而允许您导入整个存储库.

    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.

    或者,如果您可以直接访问Gerrit的存储库位置(例如,通过SSH或在本地文件系统上),则可以直接推入存储库(无论Gerrit创建了它的任何地方),而完全绕开了Gerrit.之后,您需要刷新Gerrit缓存,以使Gerrit注意到存储库HEAD已更新.

    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.

    如上所述,没有格里特格式".只需从gerrit克隆您的存储库,一切都很好.您无需担心任何特殊分支.

    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.

    这篇关于从git导入存储库到gerrit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆