There are several ways to create a new project in Gerrit:
To be able to create new projects the global capability Create Project must be granted.
In addition, projects can be created manually.
Manual Project Creation
Create a Git repository under
git --git-dir=$base_path/new/project.git initTip
By tradition the repository directory name should have a
To also make this repository available over the anonymous git:// protocol, don’t forget to create a
Either restart the server, or flush the
ssh -p 29418 localhost gerrit flush-caches --cache project_list
See details at project section.
There are several ways to create a new branch in a project:
To be able to create new branches the user must have the Create Reference access right.
When using the Web UI, the REST endpoint or the SSH command it is only possible to create branches on commits that already exist in the repository.
If a branch name does not start with
refs/ it is automatically
The starting revision for a new branch can be any valid SHA-1 expression, as long as it resolves to a commit. Abbreviated SHA-1s are not supported.
There are several ways to delete a branch:
in the Web UI under 'Projects' > 'List' > <project> > 'Branches'
via the Delete Branch REST endpoint
by using a git client
$ git push origin --delete refs/heads/<branch-to-delete>
another method, by force pushing nothing to an existing branch:
$ git push --force origin :refs/heads/<branch-to-delete>
The default branch of a remote repository is defined by its
The default branch is selected from the initial branches of the newly created project,
or set to host-level default,
if the project was created with empty branches.
For convenience reasons, when the repository is cloned Git creates a
local branch for this default branch and checks it out.
Project owners can set
in the Web UI under 'Projects' > 'List' > <project> > 'Branches' or
via the Set HEAD REST endpoint
Part of Gerrit Code Review