Skip to content

Instantly share code, notes, and snippets.

@cxmcc
Created March 21, 2017 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cxmcc/839d5eba7b24af04282b5dd9fb7d103b to your computer and use it in GitHub Desktop.
Save cxmcc/839d5eba7b24af04282b5dd9fb7d103b to your computer and use it in GitHub Desktop.
Nuke all Closed and Merged branches on a github web page.
// Paste into console
// Need to disable Content Security Policy in your browser
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
var branch_actions = $('.branch-actions');
$.each(branch_actions, function() {
var first_child = this.children[0];
if (first_child != undefined && $(first_child).attr('class') == 'pr-details') {
var state = $(first_child.children[1]);
var klass = state.attr('class');
if (klass == "state state-closed" || klass == "state state-merged") {
console.log($(first_child.children[1]).attr('title'))
var form = this.children[1];
var button = form.children[1];
$(button).click();
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment