---
title: "Upload a new Patch Set"
manual: "TYPO3 Core Contribution Guide"
version: "main"
permalink: "https://docs.typo3.org/permalink/t3contribute:lifeofapatch-improve-patch"
source: "HandlingAPatch/ChangeAPatch.rst"
rendered: "2026-09-26T04:50:59+00:00"
---

...  highlight:: bash

# Upload a new Patch Set {#lifeofapatch-improve-patch}

This chapter handles improving an existing patch. For creating a new patch, see [Create a Patch](https://docs.typo3.org/permalink/t3contribute:fixing-a-bug-a-z).

1.  Get the latest patchset of the patch

    The latest version of the patch is still in your local git repository. If not,
    you must cherry-pick the latest patch set from Gerrit as described in
    [Cherry-pick a patch](https://docs.typo3.org/permalink/t3contribute:cherry-pick-a-patch).
1.  Edit files to improve the patch
1.  Add tests (recommended)

    If you add functionality, it is a good idea to add tests.

    See [Unit testing with the TYPO3 testing framework](https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/Testing/UnitTesting/Index.html#testing-writing-unit) in TYPO3 Explained for more information
    about writing Unit Tests.
1.  Test your changes (optional)

    Run the TYPO3 testsuite locally, as described under [Using runTests.sh](https://docs.typo3.org/permalink/t3contribute:testing). Otherwise,
    don't worry, the automatic CI will do that for every committed patch set on the
    TYPO3 infrastructure.
1.  Add files and amend to commit

    Update the change by **amending** the previous commit. This will overwrite
    the commit you fetched from Gerrit with your changes:

    **shell command**

    ```bash
    git commit --amend -a
    ```

    > [!WARNING]
    > Make sure to not change or remove the Change-Id: line!

    You can amend as often as you want.

    Bear in mind that this kind of Git commit amending is a bit different than
    when you do it with GitHub (and using `force-push`). For Gerrit, every push
    will be a patch set. Previous patch sets can never be overwritten by amending,
    so do not worry.

1.  Push your change to Gerrit

    Once you are satisfied, push your improved Patch Set to Gerrit:

    **shell command**

    ```bash
    git push origin HEAD:refs/for/main
    ```

    Each pushed set will iterate a new patch set, and all previous patch sets
    can always be compared and even checked out later on.

    If you want, you can even provide an individual commit message to your push,
    so that in gerrit your code change shows up with what usually a
    "commit message subject" could do:

    **shell command**

    ```bash
    git push origin HEAD:refs/for/main%m="Some_String_Without_Whitespace"
    ```

    The underscore characters will be replaced by whitespace. You can also
    use the following bash script or shell alias to interactively do that:

    **push-with-message.sh**

    ```bash
    #!/bin/bash

    read -p "Please enter pseudo-commit message: " answer
    answer=$(echo "$answer" | tr -c '[:alnum:]' '_')
    git push origin HEAD:refs/for/main%m=$answer
    ```
