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: 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.

At Development/gerrit/SubmitPatch you find discussion of topics like:

  • submitting a new version
  • submitting patches as drafts
  • submitting patches to dictionaries, helpcontent2, translations submodules
  • ...

Detailed on 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).

Note Note: 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.

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.