Skip to content

Instantly share code, notes, and snippets.

@almirsarajcic
Created March 13, 2017 14:15
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 almirsarajcic/3b044058948d2c0f68399e8aef9a0afa to your computer and use it in GitHub Desktop.
Save almirsarajcic/3b044058948d2c0f68399e8aef9a0afa to your computer and use it in GitHub Desktop.
Remove branches from the GitHub repo
var preservedBranches = [
'master', 'develop'
];
// Remove branches on the current page
var branches = document.getElementsByClassName('branch-summary');
for (var i = 0; i < branches.length; i++) {
var branchName = branches[i].dataset.branchName;
if ( ! preservedBranches.includes(branchName)) {
branches[i].getElementsByClassName('branch-delete')[0].click();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment