How does git-review work?

Yo Yo Money Singh picture Yo Yo Money Singh · Jan 4, 2015 · Viewed 9.9k times · Source

I want to know, how exactly does git review command work? I mean does it use git push command (internally) or something else to upload the changes to gerrit. This information would be useful for me while writing git hooks for git review.

Answer

Eugene Yarmash picture Eugene Yarmash · Jan 4, 2015

From the fine manual:

When you submit a change, git review does the following things:

  • it looks up which branch to push to (production or whatever) in the .gitreview file. If it can't find this information, it pushes to master
  • it figures out what "topic" to put on the revision (you can set the topic manually with -t)
    • if you're resubmitting a downloaded change, it will reuse the tag of the original change
    • if your commit summary contains a bug number like bug 12345, the tag will be bug/12345
    • otherwise, the tag will be the name of your local branch
  • it rebases your change against the HEAD of the branch you're pushing to (use -R to skip this)
  • if you are submitting more than one change at once, or submitting a change that's based on another unmerged change, it will ask you whether you really meant to do that (use -y to skip this)
  • it pushes the change for review