clean-branches: Print the abbrev SHA for of each deleted ref

This should make it somewhat easier to recover from accidents.

(imported from commit cf7650342a4f525ffb16e77850b6e451961831b1)
This commit is contained in:
Keegan McAllister 2012-11-06 15:12:48 -05:00
parent 207ca2f351
commit 47e2f01f40
1 changed files with 4 additions and 2 deletions

View File

@ -19,7 +19,8 @@ function clean_ref {
refs/heads/*) refs/heads/*)
if is_merged "$ref"; then if is_merged "$ref"; then
echo "Deleting local branch $(echo "$ref" | sed 's!^refs/heads/!!')" echo -n "Deleting local branch $(echo "$ref" | sed 's!^refs/heads/!!')"
echo " (was $(git rev-parse --short "$ref"))"
git update-ref -d "$ref" git update-ref -d "$ref"
fi fi
;; ;;
@ -27,7 +28,8 @@ function clean_ref {
refs/remotes/origin/$USER-*) refs/remotes/origin/$USER-*)
if is_merged "$ref"; then if is_merged "$ref"; then
remote_name="$(echo "$ref" | sed 's!^refs/remotes/origin/!!')" remote_name="$(echo "$ref" | sed 's!^refs/remotes/origin/!!')"
echo "Deleting remote branch $remote_name" echo -n "Deleting remote branch $remote_name"
echo " (was $(git rev-parse --short "$ref"))"
# NB: this won't handle spaces in ref names # NB: this won't handle spaces in ref names
push_args="$push_args :$remote_name" push_args="$push_args :$remote_name"
fi fi