Bookmarklet to generate a commit message for an issue in Linear.app

Posted . Visible to the public.

Your commit messages should include the ID of the issue your code belongs to.
Our preferred syntax prefixes the issue title with its ID in brackets, e.g. [FOO-123] Avatars for users.
Here is how to generate that from an issue in Linear.

Add a new link to your browser's bookmarks bar with the following URL.

javascript:(() => {
  if (document.querySelector('[data-view-id="issue-view"]')) {
    const [id, ...words] = document.title.split(' ') ;
    prompt('Commit message:', `[${id}] ${words.join(' ')}`)
  } else {
    alert('Open issue view first')
  }
})()

When viewing an issue, you can now click that link to open a browser prompt where you can Ctrl+C your commit message.

Arne Hartherz
Last edit
Arne Hartherz
Keywords
linear, snippet
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2024-05-17 13:56)