Skip to content

Instantly share code, notes, and snippets.

@johnathan-sewell
Last active October 20, 2017 12:37
Show Gist options
  • Save johnathan-sewell/d5a68722d0d8c3d2730467bdb2f7bbb7 to your computer and use it in GitHub Desktop.
Save johnathan-sewell/d5a68722d0d8c3d2730467bdb2f7bbb7 to your computer and use it in GitHub Desktop.
branchify bookmarklet
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