Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a new Patchset in Gerrit?

I am new to Gerrit and want to create a new Patch when new changes are submitted. I setup Gerrit with this guide https://review.typo3.org/Documentation/install-quick.html

Then I try to create a new patch with http://gerrit.googlecode.com/svn/documentation/2.0/user-changeid.html and also added Change-Id line at bottom of the Commit-message.

But I am getting new Change instead of new Patchset. Can anyone help me?

Thanks

like image 866
Gangaraju Avatar asked Apr 20 '13 09:04

Gangaraju


People also ask

What is Patchset in Gerrit?

If you want to modify your change, you don't have to push a new change to Gerrit but only a new patch set . Imagine a patch sets as different versions or revisions of a change. Each patch set can receive inline comments. Gerrit uses the Change-Id of a commit message to identify patch sets of a change.

How do I create a new Gerrit?

There are several ways to create a new project in Gerrit: in the Web UI under 'Projects' > 'Create Project' via the Create Project REST endpoint. via the create-project SSH command.


2 Answers

Step 1: Install commit-msg hooks for gerrit

scp -p -P 29418 <gerrit_url>:hooks/commit-msg .git/hooks/

Step 2: Create normal commit and push (for Patchset1)

for example:

git add Server.java
git commit -m "server added"
git push origin HEAD:refs/for/master

Step 3: After doing some changes to Server.java

Finally to create new Patchset (Patchset 2)

git add Server.java
git commit --amend
git push origin HEAD:refs/for/master

Repeat step 3 for further Patches

like image 122
Gangaraju Avatar answered Sep 28 '22 13:09

Gangaraju


Don't add the Change-Id on your own. Install the commit-msg hook as described here. This will automatically create the Change-Id for you.

If you want to improve a patch by uploading a new patch-set, use git-commit --amend and keep the Change-Id line as it is.

You can see a description of the workflow here: http://wiki.typo3.org/Contribution_Walkthrough_with_CommandLine

like image 21
StephenKing Avatar answered Sep 28 '22 13:09

StephenKing