Last active
November 28, 2022 10:38
-
-
Save codebryo/29ba9b201a8b74aa02ef332e48bbb65a to your computer and use it in GitHub Desktop.
If you want to quickly delete all branches visible on one page in GitHub (e.g. stale branches) this script will click all those bucket buttons for you.
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
// Self executing loop staggered with delete requests to deal with local GH js rerenders | |
// Experiment with the timedelay of 1000 by default | |
var buttons = Array.from(document.querySelectorAll('button[title^="Delete "]')); | |
function loopIt(x) { | |
setTimeout(() => { | |
buttons[x].click(); | |
if(x < buttons.length -1) loopIt(x+1); | |
}, 1000); | |
}; | |
loopIt(0); |
Updated the script to deal with the UI lock by GitHub
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just execute that script line in the browser console on the page you are looking at ... and with the automatic reload all you need to do is click up and Enter again till you are through with all the branches!