blob: d71d19af01e83261ed093ad5a66ddc6ae35eb4ac [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Gerrit Code Review - Project Configuration
Shawn O. Pearced2b73db2009-01-09 11:55:47 -08002
Edwin Kempinf2b47e22014-04-24 13:00:28 +02003[[project-creation]]
Edwin Kempin53ae7d22014-04-17 12:53:16 +02004== Project Creation
Shawn O. Pearce6e752212009-08-12 12:22:12 -07005
Edwin Kempin53ae7d22014-04-17 12:53:16 +02006There are several ways to create a new project in Gerrit:
Shawn O. Pearce6e752212009-08-12 12:22:12 -07007
Edwin Kempin53ae7d22014-04-17 12:53:16 +02008- in the Web UI under 'Projects' > 'Create Project'
9- via the link:rest-api-projects.html#create-project[Create Project]
10 REST endpoint
11- via the link:cmd-create-project.html[create-project] SSH command
Shawn O. Pearce6e752212009-08-12 12:22:12 -070012
Edwin Kempin53ae7d22014-04-17 12:53:16 +020013To be able to create new projects the global capability
14link:access-control.html#capability_createProject[Create Project] must
15be granted.
Shawn O. Pearce6e752212009-08-12 12:22:12 -070016
Edwin Kempin53ae7d22014-04-17 12:53:16 +020017In addition, projects can be created link:#manual_project_creation[
18manually].
Shawn O. Pearce6e752212009-08-12 12:22:12 -070019
Edwin Kempin53ae7d22014-04-17 12:53:16 +020020[[manual_project_creation]]
21=== Manual Project Creation
Shawn O. Pearce6e752212009-08-12 12:22:12 -070022
Edwin Kempin53ae7d22014-04-17 12:53:16 +020023. Create a Git repository under `gerrit.basePath`:
24+
Michael Ochmannb99feab2016-07-06 14:10:22 +020025----
Shawn O. Pearce9743d0b2009-06-01 10:10:06 -070026 git --git-dir=$base_path/new/project.git init
Michael Ochmannb99feab2016-07-06 14:10:22 +020027----
Edwin Kempin53ae7d22014-04-17 12:53:16 +020028+
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080029[TIP]
Shawn O. Pearce55968232009-05-08 10:23:27 -070030By tradition the repository directory name should have a `.git`
31suffix.
Edwin Kempin53ae7d22014-04-17 12:53:16 +020032+
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080033To also make this repository available over the anonymous git://
Shawn O. Pearce55968232009-05-08 10:23:27 -070034protocol, don't forget to create a `git-daemon-export-ok` file:
Edwin Kempin53ae7d22014-04-17 12:53:16 +020035+
Michael Ochmannb99feab2016-07-06 14:10:22 +020036----
Shawn O. Pearce9743d0b2009-06-01 10:10:06 -070037 touch $base_path/new/project.git/git-daemon-export-ok
Michael Ochmannb99feab2016-07-06 14:10:22 +020038----
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080039
Edwin Kempin53ae7d22014-04-17 12:53:16 +020040. Register Project
41+
Shawn O. Pearcec756ecf2011-06-20 18:49:57 -070042Either restart the server, or flush the `project_list` cache:
Edwin Kempin53ae7d22014-04-17 12:53:16 +020043+
Michael Ochmannb99feab2016-07-06 14:10:22 +020044----
Shawn O. Pearcec756ecf2011-06-20 18:49:57 -070045 ssh -p 29418 localhost gerrit flush-caches --cache project_list
Michael Ochmannb99feab2016-07-06 14:10:22 +020046----
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080047
Edwin Kempin70363912014-04-17 16:53:38 +020048[[project_options]]
49== Project Options
50
Shawn O. Pearce6e752212009-08-12 12:22:12 -070051[[submit_type]]
Edwin Kempin70363912014-04-17 16:53:38 +020052=== Submit Type
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070053
54The method Gerrit uses to submit a change to a project can be
Edwin Kempin5819c952012-12-12 13:07:05 +010055modified by any project owner through the project console, `Projects` >
Sebastian Schuberth424984b2016-04-29 09:50:59 +020056`List` > my/project. In general, a submitted change is only merged if all
57its dependencies are also submitted, with exceptions documented below.
58The following submit types are supported:
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070059
Edwin Kempineaff6c12014-04-17 15:23:42 +020060[[fast_forward_only]]
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070061* Fast Forward Only
62+
Marcus Holl7ba39952014-12-17 14:01:31 +010063With this method no merge commits are produced. All merges must
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070064be handled on the client, prior to uploading to Gerrit for review.
65+
66To submit a change, the change must be a strict superset of the
67destination branch. That is, the change must already contain the
68tip of the destination branch at submit time.
69
Edwin Kempineaff6c12014-04-17 15:23:42 +020070[[merge_if_necessary]]
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070071* Merge If Necessary
72+
Edwin Kempin31740d62011-10-12 09:27:51 +020073This is the default for a new project.
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070074+
75If the change being submitted is a strict superset of the destination
76branch, then the branch is fast-forwarded to the change. If not,
77then a merge commit is automatically created. This is identical
Edwin Kempincdb0e002011-09-08 14:23:30 +020078to the classical `git merge` behavior, or `git merge --ff`.
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070079
Edwin Kempineaff6c12014-04-17 15:23:42 +020080[[always_merge]]
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070081* Always Merge
82+
83Always produce a merge commit, even if the change is a strict
84superset of the destination branch. This is identical to the
Edwin Kempincdb0e002011-09-08 14:23:30 +020085behavior of `git merge --no-ff`, and may be useful if the
86project needs to follow submits with `git log --first-parent`.
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070087
Edwin Kempineaff6c12014-04-17 15:23:42 +020088[[cherry_pick]]
Shawn O. Pearce3d17dbd2009-03-27 19:32:52 -070089* Cherry Pick
90+
91Always cherry pick the patch set, ignoring the parent lineage
92and instead creating a brand new commit on top of the current
93branch head.
94+
95When cherry picking a change, Gerrit automatically appends onto the
96end of the commit message a short summary of the change's approvals,
97and a URL link back to the change on the web. The committer header
98is also set to the submitter, while the author header retains the
99original patch set author.
Francois Marier8748e5e2011-04-12 16:00:37 +1200100+
Sebastian Schuberth424984b2016-04-29 09:50:59 +0200101Note that Gerrit ignores dependencies between changes when using this
102submit type unless
103link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
104is enabled and depending changes share the same topic. So generally
105submitters must remember to submit changes in the right order when using this
106submit type.
Shawn O. Pearce3d17dbd2009-03-27 19:32:52 -0700107
Edwin Kempin39462122013-03-27 09:18:19 +0100108[[rebase_if_necessary]]
Edwin Kempin00aa4f02012-09-12 13:38:44 +0200109* Rebase If Necessary
110+
111If the change being submitted is a strict superset of the destination
112branch, then the branch is fast-forwarded to the change. If not,
113then the change is automatically rebased and then the branch is
114fast-forwarded to the change.
115
Edwin Kempin37118e72011-10-12 10:04:47 +0200116When Gerrit tries to do a merge, by default the merge will only
David Pursehouse17c051d2013-05-14 17:45:00 +0900117succeed if there is no path conflict. A path conflict occurs when
118the same file has also been changed on the other side of the merge.
119
Edwin Kempineaff6c12014-04-17 15:23:42 +0200120[[content_merge]]
Sebastian Schuberth774aac92015-04-16 13:21:04 +0200121If `Allow content merges` is enabled, Gerrit will try
David Pursehouse17c051d2013-05-14 17:45:00 +0900122to do a content merge when a path conflict occurs.
Edwin Kempin37118e72011-10-12 10:04:47 +0200123
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200124[[project-state]]
Edwin Kempin70363912014-04-17 16:53:38 +0200125=== State
126
127This setting defines the state of the project. A project can have the
128following states:
129
130- `Active`:
131+
132The project is active and users can see and modify the project according
133to their access rights on the project.
134
135- `Read Only`:
136+
137The project is read only and all modifying operations on it are
138disabled. E.g. this means that pushing to this project fails for all
139users even if they have push permissions assigned on it.
140+
141Setting a project to this state is an easy way to temporary close a
142project, as you can keep all write access rights in place and they will
143become active again as soon as the project state is set back to
144`Active`.
145+
146This state also makes sense if a project was moved to another location.
147In this case all new development should happen in the new project and
148you want to prevent that somebody accidentally works on the old
149project, while keeping the old project around for old references.
150
151- `Hidden`:
152+
153The project is hidden and only visible to project owners. Other users
154are not able to see the project even if they have read permissions
155granted on the project.
156
Deniz Türkoglu52777272014-09-08 17:02:48 +0200157=== Use target branch when determining new changes to open
158
159The `create-new-change-for-all-not-in-target` option provides a
160convenience for selecting link:user-upload.html#base[the merge base]
161by setting it automatically to the target branch's tip so you can
162create new changes for all commits not in the target branch.
163
164This option is disabled if the tip of the push is a merge commit.
165
166This option also only works if there are no merge commits in the
167commit chain, in such cases it fails warning the user that such
168pushes can only be performed by manually specifying
169link:user-upload.html#base[bases]
170
171This option is useful if you want to push a change to your personal
172branch first and for review to another branch for example. Or in cases
173where a commit is already merged into a branch and you want to create
174a new open change for that commit on another branch.
175
Edwin Kempin1f556222015-04-22 13:24:39 +0200176[[require-change-id]]
Edwin Kempin70363912014-04-17 16:53:38 +0200177=== Require Change-Id
178
179The `Require Change-Id in commit message` option defines whether a
180link:user-changeid.html[Change-Id] in the commit message is required
181for pushing a commit for review. If this option is set, trying to push
182a commit for review that doesn't contain a Change-Id in the commit
183message fails with link:error-missing-changeid.html[missing Change-Id
184in commit message footer].
185
186It is recommended to set this option and use a
187link:user-changeid.html#create[commit-msg hook] (or other client side
188tooling like EGit) to automatically generate Change-Id's for new
189commits. This way the Change-Id is automatically in place when changes
190are reworked or rebased and uploading new patch sets gets easy.
191
192If this option is not set, commits can be uploaded without a Change-Id,
193but then users have to remember to copy the assigned Change-Id from the
194change screen and insert it manually into the commit message when they
195want to upload a second patch set.
196
197=== Maximum Git Object Size Limit
198
199This option defines the maximum allowed Git object size that
200receive-pack will accept. If an object is larger than the given size
201the pack-parsing will abort and the push operation will fail.
202
203With this option users can be prevented from uploading commits that
204contain files which are too large.
205
206Normally the link:config-gerrit.html#receive.maxObjectSizeLimit[maximum
207Git object size limit] is configured globally for a Gerrit server. At
208the project level, the maximum Git object size limit can be further
209reduced, but not extended. The displayed effective limit shows the
210maximum Git object size limit that is actually used on the project.
211
212The defined maximum Git object size limit is inherited by any child
213project.
214
215=== Require Signed-off-by
216
217The `Require Signed-off-by in commit message` option defines whether a
218link:user-signedoffby.html[Signed-off-by] line in the commit message is
219required for pushing a commit. If this option is set, trying to push a
220commit that doesn't contain a Signed-off-by line in the commit message
221fails with link:error-not-signed-off-by.html[not Signed-off-by
222author/committer/uploader in commit message footer].
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -0700223
Edwin Kempin34f4f882014-04-22 16:13:18 +0200224[[branch-admin]]
225== Branch Administration
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800226
Edwin Kempin34f4f882014-04-22 16:13:18 +0200227[[branch-creation]]
228=== Branch Creation
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800229
Edwin Kempin34f4f882014-04-22 16:13:18 +0200230There are several ways to create a new branch in a project:
231
232- in the Web UI under 'Projects' > 'List' > <project> > 'Branches'
233- via the link:rest-api-projects.html#create-branch[Create Branch]
234 REST endpoint
235- via the link:cmd-create-branch.html[create-branch] SSH command
236- by using a git client to push a commit to a non-existing branch
237
238To be able to create new branches the user must have the
239link:access-control.html#category_create[Create Reference] access
240right. In addition, project owners and Gerrit administrators can create
241new branches from the Web UI or via REST even without having the
242`Create Reference` access right.
243
David Pursehousea1d633b2014-05-02 17:21:02 +0900244When using the Web UI, the REST endpoint or the SSH command it is only
Edwin Kempin34f4f882014-04-22 16:13:18 +0200245possible to create branches on commits that already exist in the
246repository.
247
248If a branch name does not start with `refs/` it is automatically
249prefixed with `refs/heads/`.
250
251The starting revision for a new branch can be any valid SHA-1
252expression, as long as it resolves to a commit. Abbreviated SHA-1s
253are not supported.
254
255[[branch-deletion]]
256=== Branch Deletion
257
258There are several ways to delete a branch:
259
260- in the Web UI under 'Projects' > 'List' > <project> > 'Branches'
261- via the link:rest-api-projects.html#delete-branch[Delete Branch]
262 REST endpoint
263- by using a git client to force push nothing to an existing branch
264+
Michael Ochmannb99feab2016-07-06 14:10:22 +0200265----
Edwin Kempin34f4f882014-04-22 16:13:18 +0200266 $ git push --force origin :refs/heads/<branch-to-delete>
Michael Ochmannb99feab2016-07-06 14:10:22 +0200267----
Edwin Kempin34f4f882014-04-22 16:13:18 +0200268
269To be able to delete branches, the user must have the
270link:access-control.html#category_push[Push] access right with the
271`force` option. In addition, project owners and Gerrit administrators
272can delete branches from the Web UI or via REST even without having the
273`Force Push` access right.
274
275[[default-branch]]
276=== Default Branch
277
278The default branch of a remote repository is defined by its `HEAD`.
279For convenience reasons, when the repository is cloned Git creates a
280local branch for this default branch and checks it out.
281
282Project owners can set `HEAD`
283
284- in the Web UI under 'Projects' > 'List' > <project> > 'Branches' or
285- via the link:rest-api-projects.html#set-head[Set HEAD] REST endpoint
286
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700287
288GERRIT
289------
290Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700291
292SEARCHBOX
293---------