Skip to content

Instantly share code, notes, and snippets.

View mwagz's full-sized avatar

Matt Wagner mwagz

View GitHub Profile
@t27duck
t27duck / clear_local_branches.rb
Created December 21, 2017 14:01
Deletes local branches that have been merged into master
branch_prefix = "pt_"
branches_to_keep = []
cmd = `git branch --merged master`
branches = cmd.split("\n").map(&:strip).select{ |b| b.start_with?(branch_prefix) && !branches_to_keep.include?(b) }
branches.each do |branch|
`git branch -D #{branch}`
end