Last active
August 29, 2015 14:02
-
-
Save sekimura/ebf4c692523921a2ca4d to your computer and use it in GitHub Desktop.
git-cleanarcpatch.bash
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
#/bin/bash | |
# git-cleanarcpatch | |
# ----------------- | |
# | |
# Copyright 2014, Masayoshi Sekimura <[email protected]> | |
# Licensed under the MIT license. | |
# | |
# | |
# How to Install: | |
# | |
# 1. Add this git-cleanarcpatch.bash to ~/bin/ or somewhere you have it in | |
# PATH env variable. | |
# | |
# 2. Add a new git alias config to your ~/.gitconfig file to run this bash | |
# script form a git command "git cleanarcpatch" | |
# | |
# [alias] | |
# cleanarcpatch = "!bash ~/bin/git-cleanarcpatch.bash" | |
# | |
BRANCHES=`git branch -v | grep arcpatch` | |
if [ ${#BRANCHES} -eq 0 ]; then | |
exit | |
fi | |
for branch in "$BRANCHES[@]"; do | |
echo "$branch" | |
done | |
read -p "Are you sure you want to delete those? (Y/n) " -n 1 -r | |
echo | |
if [[ $REPLY =~ ^[Yy]$ ]]; then | |
for branch in "$BRANCHES[@]"; do | |
echo "$branch" | awk '{print "git branch -D " $1}' | bash - | |
done | |
else | |
echo | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
actually you don't need this.
or define the alias in your arcconfig file
https://secure.phabricator.com/T3277