Gerrit 简明教程

Gerrit - Prepare Push Change Set to Gerrit

在将更改合并到 master 之前,需要在 Gerrit 中查看这些更改。可以同步在 master 中发生的更改。在已处理的分支中使用以下命令。

You need to review the changes in Gerrit before merging them into the master. The changes can be synchronized that have occurred in the master. Use the following command within the branch that you have been working on.

$ git pull --rebase origin master
  1. The above command will fetch the changes or commits from the remote branch and rebase the commits on top of the master.

  2. When you are done with the changes and rebased the commits, you can push your change set to Gerrit for review.

  3. Git pull --rebase is often used when changes do not deserve a separate branch.

  4. Git pull is a combination of git fetch and git merge; where as git pull --rebase is a combination of git fetch and git rebase.

首先,运行命令 git pull origin master,如下面的屏幕截图所示。

First, run the command as git pull origin master as shown in the following screenshot.

gerrit push changes to gerrit

现在使用命令 git rebase master 对提交重新进行基于更改,如下面的屏幕截图所示。

Now use the command as git rebase master to rebase the commits as shown in the following screenshot.

gerrit push changes to gerrit1