Last active
October 20, 2017 12:37
-
-
Save johnathan-sewell/d5a68722d0d8c3d2730467bdb2f7bbb7 to your computer and use it in GitHub Desktop.
branchify bookmarklet
This file contains 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() { | |
const SEPARATOR = "_"; | |
const issueSubject = document | |
.querySelector(".subject h3") | |
.innerText.toLowerCase() | |
.trim() | |
.replace(":", "") | |
.split(" ") | |
.join(SEPARATOR); | |
const issueNumber = document | |
.querySelector("h2") | |
.innerText.split(" ") | |
.pop(); | |
const branchName = `${issueSubject}${SEPARATOR}${issueNumber}`; | |
const branchCommand = `git checkout -b ${branchName}`; | |
window.prompt('', branchCommand); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment