Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [lyo-dev] Some Git and Gerrit tips

One thing I forgot to mention.   Some folks are a little nervous about pushing to Gerrit, but don't be.   There is nothing anyone can do to "mess up" the Lyo code by pushing to Gerrit - it does not affect anything in the main Git repos.   Only a committer can merge your code with the main repos, so the responsibility for ensuring the changes are good lies there.

When you push to Gerrit, the review record will contain a Git command-line command reviewers/others can issue to pull your change in to your local Git repo (or you can use EGit).   Reviewers: if you do that to test or review someone's changes, we highly recommend creating a new, temporary, branch to pull the change into.    When you are done, simply delete the branch and when the change is merged to the main repos, you will get it on your next pull from master.

Regards,
Mike


On Thu, Nov 8, 2012 at 12:06 PM, Michael Fiedler <fiedler.mf@xxxxxxxxx> wrote:
A few Git and Gerrit tips for Lyo developers.   Some of this is covered on the contributors Getting Started page, but thought it would be worth mentioning here as well.

1.  Setting up a connection to Gerrit.   Gerrit is the preferred way to contribute code to Lyo.   Life will be much simpler for both you and the committers if you use Gerrit instead of submitting patches.

   a) Go to https://git.eclipse.org/r/#/settings/ and sign in with your Bugzilla email/passwd and click Profile to see your Gerrit username to use when configuring your connection.   This is different from your Bugzilla username.

   b) You can use https or ssh for your connection.   I've had the best luck getting folks set up with ssh.   You will need a public key and register it with Gerrit.   See http://wiki.eclipse.org/Gerrit#SSH_Keys for info on generating SSH keys from the command line (usually Linux or Mac users) or from EGit (any users, especially Windows).

  c) After cloning a Lyo Git repo, go to the Git repositories view and expand the repo you are interested (e.g. org.eclipse.lyo.core), right click Remotes and add a new remote.   Give the remote a name like "Gerrit".

  d) Configure the remote for push.   If you are using ssh, the URL should look like this:  ssh://<userid>@git.eclipse.org:29418/lyo/org.eclipse.lyo.core.git where <username> is your Gerrit username.

  e) Important:  Make sure you add a Ref mapping that looks like this:  HEAD:refs/for/<branch> where <branch> is where your commit is targeted for - usually master.

See this image for a correctly configured Gerrit Push:  http://wiki.eclipse.org/images/a/ab/Lyo_Gerrit_Config.png

2.  Amending commits.   Git and EGit have a nice feature called amend.  This allows you to add a new change to your last commit (or update the commit message).   This is useful if your change has not yet been merged into Eclipse master repo.    It also works well with Gerrit - if you get review comments you can update your code, amend the commit and the next push to Gerrit will show it as a new Patch Set on your Gerrit review record.

In EGit:  The commit dialog has a widget to amend the previous commit.
On the command line:  git commit --amend

3.  Finally, a suggested workflow for making contributions to Lyo can be found here:  http://wiki.eclipse.org/Lyo/ContributorsGettingStarted#Suggested_Git_workflow_for_making_a_change_in_Lyo

I hope this info is useful.  I'll update the contributors guide with the info not yet there.

Regards,
Mike


Back to the top