How can one take several top-level projects in Gerrit and move them under another “container” project?

I have a Gerrit installation within which are several related projects (each in a git repository). Another project is coming online would also use gerrit, but for the sake of tidiness I’d like to take the existing set of projects and put them under a new super-project (so that at the top level one sees the “umbrella” projects. I’d also like to retain the data we have for this (e.g., the review history).

How does one go about doing something like this? Another way of looking at this is, how does one move a sub-project in gerrit from one super-project to another?

  • How to configure specific upstream push refspec for Git when used with Gerrit?
  • How can i configure a project in gerrit using pygerrit2 GerritRestAPI
  • Changes in local folder not reflecting on git, openstack
  • Difference between git commit --amend and git rebase under gerrit
  • Can This Review-Based Git Workflow Be Enforced by Gerrit?
  • Is there anything for subversion as gerrit for git?
  • Git - From a server side hook, is it possible to control which branches a client can fetch
  • How can I config two different git repo with different credentials in one system?
  • Git - Push a folder after changing the remote?
  • Git isn't fetching upstream data?
  • git blame with commit details in emacs
  • How do I properly rebase a git's branch into another?
  • One Solution collect form web for “How can one take several top-level projects in Gerrit and move them under another “container” project?”

    Thanks to this blog post I stumbled upon this morning, I found a solid path to the solution! While it’s not exactly simple it’s robust and it works.

    Ensure you’ve already created the umbrella project you will be re-parenting the subproject to, and perform the following steps:

    MYGERRIT=ssh://${MYGERRIT_IP}:${MYGERRIT_PORT}
    
    mkdir ~/x
    cd ~/x
    
    # Clone the repo for the subproject you want to re-parent
    git clone ${MYGERRIT}/<subproject>
    cd <subproject>
    
    git fetch origin refs/meta/config:refs/remotes/origin/meta/config
    git checkout meta/config
    
    # Make changes to project.config
    -----> inheritFrom = <your_umbrella_project_name>
    
    # Commit changes
    git add -A
    EDITOR=vi git commit -a
    
    # Push changes
    git push origin meta/config:meta/config # If pushing directly
    #git push origin meta/config:refs/for/meta/config # If going through gerrit
    
    # Flush gerrit caches
    ssh -p ${MYGERRIT_PORT} ${MYGERRIT_IP} gerrit flush-caches --cache project_list
    ssh -p ${MYGERRIT_PORT} ${MYGERRIT_IP} gerrit flush-caches --cache projects
    
    Git Baby is a git and github fan, let's start git clone.