Skip to content

Instantly share code, notes, and snippets.

@takeshy
Created May 16, 2018 03:28
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 takeshy/bafdafb359b4aec02eb5931eeaeb87ec to your computer and use it in GitHub Desktop.
Save takeshy/bafdafb359b4aec02eb5931eeaeb87ec to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
branches = `git branch`
branches.each_line do|line|
branch = line.gsub(/\s/,"")
next if branch[0] == "*"
puts "################"
puts "#{branch}\n"
puts "################"
puts `git branch -d #{branch}`
next if $?.exitstatus == 0
meta = `git log #{branch}|head -n 6`
puts "#{meta}\n\n削除していいですか?(y/n)"
result = STDIN.gets
if result.chomp == "y"
puts `git branch -D #{branch}`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment