Skip to content

Instantly share code, notes, and snippets.

@balloob
Created February 11, 2016 23:14
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 balloob/a870128378bd17304199 to your computer and use it in GitHub Desktop.
Save balloob/a870128378bd17304199 to your computer and use it in GitHub Desktop.
Code to paste into console with GitHub open to remove branches whose PRs are merged, closed or are 0 commits ahead
Array.prototype.slice.call(document.getElementsByClassName('js-branch-row'))
.filter(el => el.getElementsByClassName('state-merged').length > 0 ||
el.getElementsByClassName('state-closed').length > 0 ||
el.getElementsByClassName('count-ahead')[0].innerHTML == '0')
.forEach(el => el.getElementsByClassName('branch-delete')[0].click())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment