Created
August 6, 2020 11:35
-
-
Save makotoshimazu/12f55e6d1580a9f21d0ccfad8a1d4610 to your computer and use it in GitHub Desktop.
Revisions
-
makotoshimazu created this gist
Aug 6, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ #!/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