Search code examples
gerritgit-gui

How push commit from Git GUI to code review on Gerrit?


When I push commit from Git Bash git push origin HEAD:refs/for/master gerrit creates code review

but how it could be made from Git GUI?


Solution

  • Pushing using Git Gui

    You can create a Tool Command to perform this action:

    1. Click on Tools > Add
    2. Add the following Tool Command

      • Name: Push2Gerrit
      • Command: git push origin HEAD:refs/for/$REVISION
    3. Check the check boxs:

      • Show a dialog before running

      • Ask the user to select a revision

      • Add globally

    4. When you need to push to Gerrit just execute Tools > Push2Gerrit and give the branch you want to push to.

    Note: you can have different specific commands (like push2master for example) and get rid the $REVISION variable and the dialog phase.

    Pushing using Gerrit UI

    You can't "push a commit" from Gerrit UI but you can create a change using just the Gerrit UI:

    1. Click on Projects > List
    2. Use the Filter field to find the project
    3. Click on the project name
    4. Click on the "General" tab
    5. Click on "Create Change" button
    6. Give the change information:

      • Select branch for new change = Branch name where the change will be created

      • Enter topic for new change = Topic of the change (opcional)

      • Description = Commit message

    7. Click on "Create" button

    This procedure will create a draft change, select it, add/remove/change files, review/approve and submit.