Mylyn, EGit, and Your Commit Message

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.

About these ads
This entry was posted in Eclipse 101, EDP. Bookmark the permalink.

2 Responses to Mylyn, EGit, and Your Commit Message

  1. Here’s an enhancement request for Mylyn to change its default: https://bugs.eclipse.org/bugs/show_bug.cgi?id=420699

  2. Unfortunately, I am currently not using eclipse and I really suffer form not being able to use Mylyn. For me, Mylyn is one of the killer features of eclipse.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s