Skip to content

Instantly share code, notes, and snippets.

@lgk-bsw
Created July 5, 2021 12:08
Show Gist options
  • Save lgk-bsw/0b56117aeccd0e55e0d7c611d5e23a77 to your computer and use it in GitHub Desktop.
Save lgk-bsw/0b56117aeccd0e55e0d7c611d5e23a77 to your computer and use it in GitHub Desktop.
Run this on the branches page of a GitHub repo to delete all merged or closed branches
const rows = document.querySelectorAll("div[data-target='branch-filter.result'] .Box-row")
for (const r of rows) {
const stateEl = r.querySelector(".State")
if (stateEl && (stateEl.title.includes("Merged") || stateEl.title.includes("Closed"))) {
r.querySelector(`button[data-target="branch-filter-item.destroyButton"]`).click()
}
//confirm("Continue?")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment