Your first pull request

Your first contribution to Collabora Online

Hello :wave:

Collabora Online has moved code review from GitHub pull requests to Gerrit, and the online and core repositories have been unified into a single monorepo (the LibreOffice core now lives under engine/ inside online). New pull requests opened against main on GitHub are automatically closed with a pointer to Gerrit — so please do not start there.

This post walks you through pushing your first patch the new way.


TL;DR — the canonical workflow

# 1. Sign in once at https://gerrit.collaboraoffice.com (use your GitHub account)
# 2. Add your SSH key at https://gerrit.collaboraoffice.com/settings/#SSHKeys

# 3. Clone the monorepo
git clone ssh://YOUR_USERNAME@gerrit.collaboraoffice.com:29418/online
cd online

# 4. Install the commit-msg hook (adds the Change-Id automatically)
scp -p -P 29418 YOUR_USERNAME@gerrit.collaboraoffice.com:hooks/commit-msg .git/hooks/

# 5. Hack, build, test
# 6. Commit with signoff
git commit -s

# 7. Send the patch for review
git push origin HEAD:refs/for/main

The terminal prints a Gerrit URL — that is your change. Reviewers will leave comments there, and CI will vote on it.


Step by step

1. Sign in to Gerrit

Go to https://gerrit.collaboraoffice.com and sign in with your GitHub account. The first sign-in creates your Gerrit profile.

2. Add your SSH key

Open https://gerrit.collaboraoffice.com/settings/#SSHKeys and paste the public half of an SSH key you control. If you don’t have one yet, generate it with ssh-keygen -t ed25519.

3. Clone the monorepo

git clone ssh://YOUR_USERNAME@gerrit.collaboraoffice.com:29418/online
cd online

There is no separate core clone any more — the LibreOffice core sits under engine/ inside this repo. (Background reading: Open Source in Action #2 — monorepo unification.)

4. Install the commit-msg hook

Gerrit identifies a logical change by a Change-Id: trailer in the commit message. The hook adds it automatically:

scp -p -P 29418 YOUR_USERNAME@gerrit.collaboraoffice.com:hooks/commit-msg .git/hooks/

If you skip this step Gerrit will reject your push and tell you so.

5. Build it

6. Pick something to work on

Browse the newcomer-friendly list: https://collaboraonline.github.io/post/easyhacks/

7. Make your change

Work on main directly or on a local branch — Gerrit doesn’t care about your local branch names, only about the commit you push. Build, test, then:

git add path/to/changed/file
git commit -s        # -s is short for --signoff — see DCO note below

An editor opens. Write a good commit message — see Best practices below.

8. Push for review

git push origin HEAD:refs/for/main

The magic refspec is refs/for/main (not refs/heads/main). Gerrit replies with a URL to your change — open it, add reviewers if you know who should look, and watch CI run.

9. Address review feedback

When a reviewer asks for changes, amend the same commit rather than stacking a fix-up on top. Because the Change-Id: trailer stays the same, Gerrit recognises it as a new patchset of the same change:

# edit, build, test
git add ...
git commit --amend          # keep the Change-Id line untouched
git push origin HEAD:refs/for/main

If you stacked several commits, each one becomes its own Gerrit change, reviewed in order.

10. Merging

Once a reviewer gives +2 and CI is happy, the change is submitted from the Gerrit web UI. There is no “merge button” on your side.


Project policies — please read

Rather than duplicate text here (where it would drift), the canonical source is CONTRIBUTING.md in the repo:


Best practices for git commit messages

Read How to Write a Git Commit Message by Chris Beams. The short version:

  • Imperative mood, present tense. “Fix hang in foo()”, not “Fixed hang in foo()”.
  • Subject line under ~72 characters, no trailing period. It is a summary, not a sentence.
  • Blank line, then a body explaining why the change is needed. The “how” is in the diff; the “why” is your responsibility.
  • If the change is conceptually trivial, a one-line subject is fine.

A good Gerrit commit ends up looking like:

Fix hang in foo() when bar is empty

Previously foo() spun forever if bar arrived empty because the
exit condition only checked size > 0 after the first iteration.
Check the condition up front so we bail out cleanly.

Signed-off-by: Random J Developer <random@developer.example.org>
Change-Id: Iabc123...

The Change-Id line is added by the commit-msg hook — don’t write it by hand.


Stuck?

Drop into one of our communication channels — IRC #cool-dev on Libera, Telegram, or this forum. Happy hacking!

1 Like

Thanks Pedro,

As I didn’t build COOL (Step 4), my step 4 is:
4. ./scripts/refresh-git-hooks than cp .git-hooks/commit-msg .git/hooks/commit-msg

I have turn this into a wiki post (so everyone can edit)

Forum post updated :slight_smile:

1 Like