From The Document Foundation Wiki
Jump to: navigation, search

Submit a patch for review with gerrit

Add yourself to the contributor list

If this is the first time you are contributing a patch to the LibreOffice project, please add yourself to the developer and contributor list (following the instructions there) and state the license of your contributions.

Submitting patches for review

Then create and push your change to gerrit for review (official gerrit documentation is here):

git checkout -b <a_local_branch_name_of_your_choice>
# Do your code changes, make sure it will build
git add file [file ...] # all the new files _and_ changed files
git commit
./logerrit submit master

Note: for the `logerrit` command to work, make sure you have set yourself up o for gerrit. Instructions can be found here.

Note: the git add + git commit step can be done using 'git gui', please remember that the commit subject line should not be longer than 65 characters and the commit message lines, if any, should not be longer than 70 character.

Only the last line is special and will push all patches in the named local branch to the review queue for the master branch (Adjust accordingly, if you want to submit a patch to one of the release branches or other branches). As a casual contributor your patch needs to have the same email address as your gerrit account has or you will not be allowed to push.

If the push succeeds, git will report where your commit is waiting for review. The url will look something like

It is a good idea to keep your local branch around while your patch is under review, that will allow to possibly easily push a new version of the patch. In the mean time you can

git checkout master

To return to the master branch... and you can start working on another patch using again the procedure above (create local branch, code, commit, push to gerrit).

More on patch submission

As an alternative to the above, you can consider using "git review", as explained at Development/GitReview.

Detailed discussion on some patch submission topics

Submitting a new version

If during the review of one of your patch you need to submit a new version of it, then do:

git checkout <local_branch_associated_with_your_patch>
<do your modification>
git add ...
git commit --amend  # this modifies the last commit on the branch rather than creating a new one
./logerrit submit master

Note that gerrit will detect that it is a new version of an existing change (thanks to the Change-Id).


If you accidentally forgot to use --amend and now have 2 commits, you can merge them with git rebase -i; see Git For LibreOffice Developers for instructions.

Using git review to amend changes and submit new patch versions

Amending changes manually in the above way can quickly get confusing and keeping track of local_branch_associated_with_your_patch is error prone (associated how anyway?). If you submitted several changes to gerrit then keeping them all on the master branch and amending them independently is impossible. You will either have to reset HEAD^ after each submission and download/modify/amend/submit/reset for each new patch set, or do that in separate branches and this is where git review comes in handy.

Please read Development/GitReview#Amending_a_gerrit_change for how to do that.

Submitting patches as drafts

If you use ./logerrit submit-draft master instead of ./logerrit submit master, you will create a draft change.

Such a change will only be visible to yourself and whoever you add as a reviewer with the 'add reviewer' button in gerrit. It can be practical for discussing changes that are 'Work in Progress'.

If you are not using logerrit, just push to refs/drafts/branch instead of refs/for/branch.

Submit patches for review from dictionaries, helpcontent2, translations submodules

See the page dedicated to Submodules.