Last active
June 18, 2020 01:40
-
-
Save salarmehr/e907677852342bcf16a675fe9a8e294b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// while Jira has a create branch botton, it take some seconds to create a branch and use it locally | |
// it's quicker to generate the git command and run it locally. | |
// run in in console or create a brower bookmark prefixing it with `javascript:` and copy this gist as url. | |
// now you can click on the bookmakr button ot copy the git command to clipboard. | |
function copy(text) { | |
var input = document.createElement('input'); | |
input.setAttribute('value', text); | |
document.body.appendChild(input); | |
input.select(); | |
var result = document.execCommand('copy'); | |
document.body.removeChild(input); | |
return result; | |
} | |
var type = jQuery('[src$=issuetype]').length ? 'feature' : 'bugfix'; | |
var number = jQuery('title').text().match(/\[(.*)\]/)[1]; | |
var title=jQuery('title').text().match('(])(.*)(-)')[2].trim().replace(/[ ~\^:]/g,'_').replace(/['"]/g,'\\$&'); | |
copy('git checkout -b '+type+'/'+number+'--'+title); | |
ghost
commented
Jun 18, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment