-
-
Save rweald/6337270 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
exec scala -savecompiled "$0" "$@" | |
!# | |
// Get the shell scripting enrichments | |
import scala.sys.process._ | |
val alwaysKeep = Set("develop", "master") | |
// Now delete any merged branches" | |
val branches: String = "git branch".!! | |
// Have to use augmentString explicitly because the process implicits conflict | |
augmentString(branches) | |
.lines | |
.map { line => if(line(0) == '*') line.drop(1).trim else line.trim } | |
.filterNot(alwaysKeep) | |
.foreach { branch => | |
("git branch -d %s".format(branch)).! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment