blob: 94af04f83c02f94b35aff8706af8b1e6a1864c5a [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+
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080025====
Shawn O. Pearce9743d0b2009-06-01 10:10:06 -070026 git --git-dir=$base_path/new/project.git init
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080027====
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+
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080036====
Shawn O. Pearce9743d0b2009-06-01 10:10:06 -070037 touch $base_path/new/project.git/git-daemon-export-ok
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080038====
39
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+
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080044====
Shawn O. Pearcec756ecf2011-06-20 18:49:57 -070045 ssh -p 29418 localhost gerrit flush-caches --cache project_list
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080046====
47
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` >
56`List` > my/project. The following methods are supported:
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070057
Edwin Kempineaff6c12014-04-17 15:23:42 +020058[[fast_forward_only]]
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070059* Fast Forward Only
60+
Marcus Holl7ba39952014-12-17 14:01:31 +010061With this method no merge commits are produced. All merges must
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070062be handled on the client, prior to uploading to Gerrit for review.
63+
64To submit a change, the change must be a strict superset of the
65destination branch. That is, the change must already contain the
66tip of the destination branch at submit time.
67
Edwin Kempineaff6c12014-04-17 15:23:42 +020068[[merge_if_necessary]]
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070069* Merge If Necessary
70+
Edwin Kempin31740d62011-10-12 09:27:51 +020071This is the default for a new project.
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070072+
73If the change being submitted is a strict superset of the destination
74branch, then the branch is fast-forwarded to the change. If not,
75then a merge commit is automatically created. This is identical
Edwin Kempincdb0e002011-09-08 14:23:30 +020076to the classical `git merge` behavior, or `git merge --ff`.
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070077
Edwin Kempineaff6c12014-04-17 15:23:42 +020078[[always_merge]]
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070079* Always Merge
80+
81Always produce a merge commit, even if the change is a strict
82superset of the destination branch. This is identical to the
Edwin Kempincdb0e002011-09-08 14:23:30 +020083behavior of `git merge --no-ff`, and may be useful if the
84project needs to follow submits with `git log --first-parent`.
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -070085
Edwin Kempineaff6c12014-04-17 15:23:42 +020086[[cherry_pick]]
Shawn O. Pearce3d17dbd2009-03-27 19:32:52 -070087* Cherry Pick
88+
89Always cherry pick the patch set, ignoring the parent lineage
90and instead creating a brand new commit on top of the current
91branch head.
92+
93When cherry picking a change, Gerrit automatically appends onto the
94end of the commit message a short summary of the change's approvals,
95and a URL link back to the change on the web. The committer header
96is also set to the submitter, while the author header retains the
97original patch set author.
Francois Marier8748e5e2011-04-12 16:00:37 +120098+
99Note that Gerrit ignores patch set dependencies when operating in
100cherry-pick mode. Submitters must remember to submit changes in
101the right order since inter-change dependencies will not be
102enforced for them.
Shawn O. Pearce3d17dbd2009-03-27 19:32:52 -0700103
Edwin Kempin39462122013-03-27 09:18:19 +0100104[[rebase_if_necessary]]
Edwin Kempin00aa4f02012-09-12 13:38:44 +0200105* Rebase If Necessary
106+
107If the change being submitted is a strict superset of the destination
108branch, then the branch is fast-forwarded to the change. If not,
109then the change is automatically rebased and then the branch is
110fast-forwarded to the change.
111
Edwin Kempin37118e72011-10-12 10:04:47 +0200112When Gerrit tries to do a merge, by default the merge will only
David Pursehouse17c051d2013-05-14 17:45:00 +0900113succeed if there is no path conflict. A path conflict occurs when
114the same file has also been changed on the other side of the merge.
115
Edwin Kempineaff6c12014-04-17 15:23:42 +0200116[[content_merge]]
David Pursehouse17c051d2013-05-14 17:45:00 +0900117If `Automatically resolve conflicts` is enabled, Gerrit will try
118to do a content merge when a path conflict occurs.
Edwin Kempin37118e72011-10-12 10:04:47 +0200119
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200120[[project-state]]
Edwin Kempin70363912014-04-17 16:53:38 +0200121=== State
122
123This setting defines the state of the project. A project can have the
124following states:
125
126- `Active`:
127+
128The project is active and users can see and modify the project according
129to their access rights on the project.
130
131- `Read Only`:
132+
133The project is read only and all modifying operations on it are
134disabled. E.g. this means that pushing to this project fails for all
135users even if they have push permissions assigned on it.
136+
137Setting a project to this state is an easy way to temporary close a
138project, as you can keep all write access rights in place and they will
139become active again as soon as the project state is set back to
140`Active`.
141+
142This state also makes sense if a project was moved to another location.
143In this case all new development should happen in the new project and
144you want to prevent that somebody accidentally works on the old
145project, while keeping the old project around for old references.
146
147- `Hidden`:
148+
149The project is hidden and only visible to project owners. Other users
150are not able to see the project even if they have read permissions
151granted on the project.
152
Deniz Türkoglu52777272014-09-08 17:02:48 +0200153=== Use target branch when determining new changes to open
154
155The `create-new-change-for-all-not-in-target` option provides a
156convenience for selecting link:user-upload.html#base[the merge base]
157by setting it automatically to the target branch's tip so you can
158create new changes for all commits not in the target branch.
159
160This option is disabled if the tip of the push is a merge commit.
161
162This option also only works if there are no merge commits in the
163commit chain, in such cases it fails warning the user that such
164pushes can only be performed by manually specifying
165link:user-upload.html#base[bases]
166
167This option is useful if you want to push a change to your personal
168branch first and for review to another branch for example. Or in cases
169where a commit is already merged into a branch and you want to create
170a new open change for that commit on another branch.
171
Edwin Kempin70363912014-04-17 16:53:38 +0200172=== Require Change-Id
173
174The `Require Change-Id in commit message` option defines whether a
175link:user-changeid.html[Change-Id] in the commit message is required
176for pushing a commit for review. If this option is set, trying to push
177a commit for review that doesn't contain a Change-Id in the commit
178message fails with link:error-missing-changeid.html[missing Change-Id
179in commit message footer].
180
181It is recommended to set this option and use a
182link:user-changeid.html#create[commit-msg hook] (or other client side
183tooling like EGit) to automatically generate Change-Id's for new
184commits. This way the Change-Id is automatically in place when changes
185are reworked or rebased and uploading new patch sets gets easy.
186
187If this option is not set, commits can be uploaded without a Change-Id,
188but then users have to remember to copy the assigned Change-Id from the
189change screen and insert it manually into the commit message when they
190want to upload a second patch set.
191
192=== Maximum Git Object Size Limit
193
194This option defines the maximum allowed Git object size that
195receive-pack will accept. If an object is larger than the given size
196the pack-parsing will abort and the push operation will fail.
197
198With this option users can be prevented from uploading commits that
199contain files which are too large.
200
201Normally the link:config-gerrit.html#receive.maxObjectSizeLimit[maximum
202Git object size limit] is configured globally for a Gerrit server. At
203the project level, the maximum Git object size limit can be further
204reduced, but not extended. The displayed effective limit shows the
205maximum Git object size limit that is actually used on the project.
206
207The defined maximum Git object size limit is inherited by any child
208project.
209
210=== Require Signed-off-by
211
212The `Require Signed-off-by in commit message` option defines whether a
213link:user-signedoffby.html[Signed-off-by] line in the commit message is
214required for pushing a commit. If this option is set, trying to push a
215commit that doesn't contain a Signed-off-by line in the commit message
216fails with link:error-not-signed-off-by.html[not Signed-off-by
217author/committer/uploader in commit message footer].
Shawn O. Pearce97cd0ca2009-03-27 16:53:32 -0700218
Edwin Kempin34f4f882014-04-22 16:13:18 +0200219[[branch-admin]]
220== Branch Administration
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800221
Edwin Kempin34f4f882014-04-22 16:13:18 +0200222[[branch-creation]]
223=== Branch Creation
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800224
Edwin Kempin34f4f882014-04-22 16:13:18 +0200225There are several ways to create a new branch in a project:
226
227- in the Web UI under 'Projects' > 'List' > <project> > 'Branches'
228- via the link:rest-api-projects.html#create-branch[Create Branch]
229 REST endpoint
230- via the link:cmd-create-branch.html[create-branch] SSH command
231- by using a git client to push a commit to a non-existing branch
232
233To be able to create new branches the user must have the
234link:access-control.html#category_create[Create Reference] access
235right. In addition, project owners and Gerrit administrators can create
236new branches from the Web UI or via REST even without having the
237`Create Reference` access right.
238
David Pursehousea1d633b2014-05-02 17:21:02 +0900239When using the Web UI, the REST endpoint or the SSH command it is only
Edwin Kempin34f4f882014-04-22 16:13:18 +0200240possible to create branches on commits that already exist in the
241repository.
242
243If a branch name does not start with `refs/` it is automatically
244prefixed with `refs/heads/`.
245
246The starting revision for a new branch can be any valid SHA-1
247expression, as long as it resolves to a commit. Abbreviated SHA-1s
248are not supported.
249
250[[branch-deletion]]
251=== Branch Deletion
252
253There are several ways to delete a branch:
254
255- in the Web UI under 'Projects' > 'List' > <project> > 'Branches'
256- via the link:rest-api-projects.html#delete-branch[Delete Branch]
257 REST endpoint
258- by using a git client to force push nothing to an existing branch
259+
260====
261 $ git push --force origin :refs/heads/<branch-to-delete>
262====
263
264To be able to delete branches, the user must have the
265link:access-control.html#category_push[Push] access right with the
266`force` option. In addition, project owners and Gerrit administrators
267can delete branches from the Web UI or via REST even without having the
268`Force Push` access right.
269
270[[default-branch]]
271=== Default Branch
272
273The default branch of a remote repository is defined by its `HEAD`.
274For convenience reasons, when the repository is cloned Git creates a
275local branch for this default branch and checks it out.
276
277Project owners can set `HEAD`
278
279- in the Web UI under 'Projects' > 'List' > <project> > 'Branches' or
280- via the link:rest-api-projects.html#set-head[Set HEAD] REST endpoint
281
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700282
283GERRIT
284------
285Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700286
287SEARCHBOX
288---------