Skip to content

Instantly share code, notes, and snippets.

@fujimura
Created June 25, 2012 12:05
Show Gist options
  • Save fujimura/2988204 to your computer and use it in GitHub Desktop.
Save fujimura/2988204 to your computer and use it in GitHub Desktop.
Delete remote branches except master
git branch -a | grep origin | cut -d / -f 3 | grep -v master | \
ruby -e "STDIN.to_a.tap(&:shift).map(&:chomp).each {|s| p %|git push origin :#{s}| }"
# replace `p` with `system` to run actual command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment