Created
February 4, 2020 06:48
-
-
Save salarmehr/4d88ddd439654d6e669005914a47f21c 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
// 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 = $('.view-header .tau-entity-icon-full').eq(1).text(); | |
var number = $('.entity-id').eq(1).text(); | |
var title = $('.view-header__entity-title').eq(1).text(); | |
var branchTitle = title.replace(/[ ~\^:]/g, '_').replace(/['"]/g, '\\$&'); | |
var commit = `${number} ${title}`; | |
var checkout = 'git checkout -b ' + type + '/' + number + '-' + branchTitle; | |
copy(commit); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment