Skip to content

Instantly share code, notes, and snippets.

@victorlin
Last active March 20, 2024 02:27
Show Gist options
  • Save victorlin/9c0be8f2d3305eae4d7bb8c5907a9e17 to your computer and use it in GitHub Desktop.
Save victorlin/9c0be8f2d3305eae4d7bb8c5907a9e17 to your computer and use it in GitHub Desktop.
Delete stale branches from the GitHub repo's stale branches page (github.com/user/repo/branches/stale). Originally from https://stackoverflow.com/a/69089905
// Paste in browser console and run
async function deleteStaleBranches(delay=500) {
var stale_branches = document.getElementsByClassName('js-branch-delete-button');
for (var i = 0; i < stale_branches.length; i++)
{
stale_branches.item(i).click();
await new Promise(r => setTimeout(r, delay));
}
}
(() => { deleteStaleBranches(500); })();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment