Created
April 11, 2012 09:40
-
-
Save mercuryrain/2358275 to your computer and use it in GitHub Desktop.
Bookmarklet to get branch name
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
javascript:(function($,window,undefined){var key=$("#key-val").text(),descr=$("h1").text(),errors="",sprintLabels=$.grep(jQuery("ul.labels li"),function(el){return $(el).text().match(/sprint/);});if(!key.length)errors+="Key is not defined\n";if(!descr.length)errors+="Description is not defined\n";if(!sprintLabels.length)errors+="Sprint label is not defined\n";if(errors.length){alert(errors);return;}var sprint=$(sprintLabels[0]).text(),branchName=sprint+'_UA_'+key+'_'+descr.toLowerCase().replace(/\(\)/g,'').replace(/\W/g,'_').replace(/_+/g,'_').replace(/_$/g,'');window.prompt("Branch name:\n"+branchName+"\n"+"Create branch:\ngit checkout -b "+branchName,branchName);})(jQuery,window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment