Created
December 21, 2017 14:01
-
-
Save t27duck/5010ae0e8d1c2fc760f539b451841b8e to your computer and use it in GitHub Desktop.
Deletes local branches that have been merged into master
This file contains 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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Without the prefix, maybe?