Skip to content

Instantly share code, notes, and snippets.

@agate
Created December 22, 2015 03:54
Show Gist options
  • Save agate/defa31077a59bf5e81ee to your computer and use it in GitHub Desktop.
Save agate/defa31077a59bf5e81ee to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Github Issue Branch Name
// @namespace http://agate.github.com
// @version 0.1
// @description Auto generate feature branch with issue's title
// @author agate
// @match https://github.com/*/*/issues/*
// @grant none
// ==/UserScript==
var $jqTitle = $('.gh-header-title');
var title = $jqTitle.text();
var branchName = title.split("\n").join(" ")
.replace(/\s+/g, " ").trim().toLowerCase()
.replace(/[^\w ]/g, ' ')
.replace(/\s+/g, '_')
.replace(/^_*/, '');
$jqTitle.append('<span style="display: block; color: gray; font-size: 18px; font-weight: lighter; margin-top: 8px;"><strong>BRANCH NAME:</strong> ' + branchName + '</span>');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment