2

My workplace started using Gerrit and git review, which I've never used before. My remote is called acme, but it seems like git review wants the remote to be called gerrit. If possible I'd like to avoid changing the name of my remote. I'd like my remote to still be called acme and I want git review to work with that remote as if it was called gerrit. Is that possible?

Ram Rachum
  • 84,019
  • 84
  • 236
  • 374

1 Answers1

1

You don't necessarily want git review to be using the same remote you use for your regular work. The OpenStack project makes heavy use of Gerrit, and a typical checked out project, after configuring Gerrit, might look like:

$ git remote -v
gerrit  ssh://lars@review.openstack.org:29418/openstack/nova.git (fetch)
gerrit  ssh://lars@review.openstack.org:29418/openstack/nova.git (push)
larsks  git@github.com:larsks/nova.git (fetch)
larsks  git@github.com:larsks/nova.git (push)
origin  git://github.com/openstack/nova.git (fetch)
origin  git://github.com/openstack/nova.git (push)

In this example, origin is a read-only remote from which I can pull changes, and gerrit is the remote used by git-review to submit reviews. There's a remote named larsks that maps to my personal GitHub repository; I use this one to stage changes before submitting them to gerrit (this makes sure that if my laptop blows up the changes are preserved, and it also makes it convenient to move between a couple of different workstations and use this remote for syncing back and forth).

You can of course also just create multiple remotes that have different names but point to the same URL, if that's ultimately how you want things to work.

(If you're curious, you can read more about the Openstack gerrit workflow)

larsks
  • 277,717
  • 41
  • 399
  • 399
  • Appreciate the answer and thoughts on why you may not want to do it, but you haven't answered the question. I agree with you but don't have control over the remotes in the repo I'm using. – mithunc Jul 26 '17 at 20:37