2012-12-22

Forking GIT project to Gerrit

Going through your own changes before you decide to carry on is a pretty good idea. I treat it myself as a form of checkpoint: I can approve my changes at any time, but the more important thing is: I can find all the hacks I made along the way.

It turns out to be a pretty good idea to use Gerrit even when you contribute your changes to other repositories, or even when you want to keep your custom changes to yourself and at the same time be able to stay up to date with remote changes.

So how does that work, in short?

  1. Open up Gerrit website and navigate to Projects. Create a new project, that will be a fork of another repository. Create initial commit, it may make things easier;
  2. Open Access configuration for this project. Create new reference refs/* and add 
    1. permission Push merge commits to project owners group (that will allow you to invoke git push);
    2. permission Forge commiter identity - this will be required by Gerrit to accept the changes you are not an author of.
  3. Clone this repository;
  4. Branch off the master branch;
  5. Add new upstream: git remote add upstream ;
  6. Merge the upstream's master branch to your local master branch
  7. Push changes to gerrit using git push origin master.

That's pretty much it. Good thing about mixture like the above is: you can - at any time in the future - recreate this exact configuration. It will work. You will also be able to push changes - once reviewed - to your upstream repository.

Good luck!

No comments:

Post a Comment