Skip to content

Instantly share code, notes, and snippets.

@thiamsantos
Created October 26, 2018 19:33
Show Gist options
  • Save thiamsantos/b63ebe9006ff1e5f3ecbe20ade6a28c7 to your computer and use it in GitHub Desktop.
Save thiamsantos/b63ebe9006ff1e5f3ecbe20ade6a28c7 to your computer and use it in GitHub Desktop.
valid_branchs = [
"master"
]
"git"
|> System.cmd(["branch"])
|> elem(0)
|> String.split("\n")
|> Enum.map(&String.trim/1)
|> Enum.reject(&match?("", &1))
|> Enum.reject(&String.starts_with?(&1, "*"))
|> Enum.reject(&Enum.member?(valid_branchs, &1))
|> Enum.each(fn branch ->
"git"
|> System.cmd(["branch", "-D", branch])
|> IO.inspect()
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment