Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In Gerrit, several ongoing-review branches or "changes" can coexist without conflicts until they are merged to a mainstream branch (usually the master). This way, several paths for the project can be explored simultaneously even if they implement a same feature. However, if a change is getting too old, it may become impossible to merge because the mainstream branch has evolved too much meanwhile. In that case, you have to rebase the change on the mainstream branch and resolve potential conflicts before merging it.

Upload a Change

...

$ git commit
$ git push origin HEAD:refs/for/master

// this is the same as:
$ git commit
$ git push origin HEAD:refs/for/refs/heads/master

// or with git-review
$ git commit
$ git-review -T master
// or simply "
$ git-review -T" provided you used the default master branch with git-clone when cloning the repository

...

// push patch set
$ git push origin HEAD:refs/for/master
// or with git-review
$ git-review -T master
// or simply "$ git-review -T" provided you used the default master branch with git-clone when cloning the repository

...

Pushing a new patch set will trigger an email notification to the reviewers.

The option -T is used to avoid adding a topic to the change. If no topic is specified, git-review will add the change number as a topic in Gerrit we interface.

Submitting simultaneously several changes for review : a simple example

...

Repeat the operation as much time as necessary

$ git-review -T

git-review usually displays a warning and ask confirmation when doing this. If the changes are accepted, the Gerrit web interface will display information on changes submitted together when looking at one of them. The option -y avoids this message.

NOTE: When cascading more changes, the first call "git-review" may fail because of the absence of a change-id in the git commit message logs. Retry "git-review" in that case or try to run git hook manually to modify the git log history (not so easy). If you do not have gerrit git hooks pre-installed, this only works for the absence o Change-id in the last commit. Use  interactive rebase and reword ("git-rebase -i HEAD~N") in that case.
Sometimes, it can be useful to rework dependencies or "squash" several ongoing-review changes. In that case use git interactive rebase https://backlog.com/git-tutorial/stepup/stepup7_5.html

...