Skip to content

Instantly share code, notes, and snippets.

@chsh
Created March 17, 2015 02:16
Show Gist options
  • Select an option

  • Save chsh/21386e072b16d7fdb5a2 to your computer and use it in GitHub Desktop.

Select an option

Save chsh/21386e072b16d7fdb5a2 to your computer and use it in GitHub Desktop.
git: remove merged branches with confirmation.
#!/bin/bash
read -p "Do you wish to remove merged branches? " yn
case $yn in
[Yy]* ) echo "Removing merged branches..."; break;;
* ) echo "Nothing to do."; exit;;
esac
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
@chsh

chsh commented Mar 17, 2015

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment