• Share this article:

Mylyn, EGit, and Your Commit Message

Tuesday, November 5, 2013 - 13:30 by Wayne Beaton

If you’re using the task-focused UI from Mylyn, then you get a lot of help when it comes to assembling a message for your commit (if you’re not using the task-focused UI from Mylyn, then you need to re-examine your wasted life). Mylyn automatically populates the commit message in the EGit commit dialog.

The EGit Commit Dialog

The EGit Commit Dialog

There are two different things at work here. First, the bulk of the message is created automatically by Mylyn using information from the task. In this case, my task comes from the eclipse.org Bugzilla instance. The second bit is the “Signed-off-by” statement; this is inserted by EGit when you click the “Add Signed-off-by” button (signed-off-by)

You can configure the shape of the commit message via the preferences. Navigate to Mylyn > Team and you should see something like this:

The Mylyn Tasks "Team" Preferences Page

The Mylyn Tasks “Team” Preferences Page

I’ve modified the commit comment template into this form:

[${task.key}] ${task.description} 

Bug: ${task.url}

The template places the bug number in square brackets ahead of the summary of the bug. I’ve left the body empty, and have included a “Bug:” statement in the footer. At some point, I may change my default template to include something like “type more here” for the message body. Mylyn provides all sorts of fields that you can use in your commit message. They’re available by hitting ctrl-space (content assist) with your cursor in the text area.

Mylyn makes it simple and easy to make a direct connection between your commit and the corresponding discussion in Bugzilla.

Seriously, start using the task-focused UI. It will change your life.