Last active
September 28, 2019 02:31
-
-
Save makotoshimazu/1442f096c98e3bd18b8dca3e9394d62c to your computer and use it in GitHub Desktop.
This file contains hidden or 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/zsh | |
autoload -Uz colors | |
colors | |
echo " hash | branch" | |
echo "--------+----------------------" | |
git branch -vv | grep gone | sed -E 's/ +/ /g' | cut -d ' ' -f 2,3 | | |
while read branch_name rev | |
do | |
#echo "branch: ${fg[green]}${branch_name}${reset_color} revision: ${fg[green]}${rev}${reset_color}" | |
printf "${fg[green]}%-8s${reset_color}| %s\n" "${rev}" "${branch_name}" | |
done | |
echo "" | |
echo -n "Are you okay to remove these branches? [y/N]: " | |
read RESULT | |
case $RESULT in | |
[Yy]) | |
;; | |
*) | |
exit 1 | |
;; | |
esac | |
git branch -vv | grep gone | sed -E 's/ +/ /g' | cut -d ' ' -f 2,3 | | |
while read branch_name rev | |
do | |
tag_name="archived__${branch_name}" | |
git tag ${tag_name} ${rev} | |
git branch -D ${branch_name} | |
echo "Created a tag: ${tag_name} (${rev})" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment