Skip to content

Instantly share code, notes, and snippets.

View codebryo's full-sized avatar
🚀
...

Roman Kuba codebryo

🚀
...
View GitHub Profile
@codebryo
codebryo / delete_branches_on_page.js
Last active November 28, 2022 10:38
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.
// 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);