Posted almost 12 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:

Copy
[#12345] Add Google Maps to user profiles Optional further commit messages in the body

Also see Howto: Write a proper git commit message

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

Copy
javascript:(function($) { var storyTitles = []; var stories = $('.story[data-selected="true"]').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.

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for unsupported versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2).

Owner of this card:

Avatar
Henning Koch
Last edit:
3 months ago
by Felix Eschey
Attachments:
pt_branch.js
Keywords:
pivotaltracker
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 short-lived cookies to improve usability.
Accept or learn more