Posted over 9 years ago. Visible to the public.

Bookmarklet to generate a commit message with Pivotal Tracker story ID and title

For clarity and traceability, your commit messages should include the ID and title of the Pivotal Tracker story you're working on. For example:

[#12345] Add Google Maps to user profiles

To quickly generate such commit messages, add a new link "Commit" to your bookmarks and use the following Javascript as the link URL:

javascript:(function($) { var storyTitles = []; var stories = $('.story .selector.selected').closest('.story'); var collapsed = true; if (stories.length == 0) { stories = $('.story .details').closest('.story'); collapsed = false; } stories.each(function() { var story = $(this); var title = (collapsed ? story.find('[data-aid="StoryPreviewItem__title"]').text() : story.find('[name="story[name]"]').val()); var id = /story_(\d+)/.exec(story.attr('class'))[1]; if (id && title) { var gitptTitle = '[#' + id + '] ' + title; if (storyTitles.indexOf(gitptTitle) == -1) { storyTitles.push(gitptTitle); } } }); if (storyTitles.length > 0) { prompt('Your commit message:', storyTitles.join('; ')); } else { alert("Please select the stories first."); } })(jQuery);

When you now open one or more stories in Pivotal Tracker and hit the bookmarklet, it will display a prompt with a commit message. You can also select the stories using the blue box next to them.

To add the bookmarklet to Firefox first add a new bookmark then right click the bookmark and open properties. Paste your code snippet in the location field.

We also have a shell script for this.

Once an application no longer requires constant development, it needs periodic maintenance for stable and secure operation. makandra offers monthly maintenance contracts that let you focus on your business while we make sure the lights stay on.

Owner of this card:

Henning Koch
Last edit:
over 1 year ago
by Arne Hartherz
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Henning Koch to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more