Skip to content

Commit

Permalink
Highlight branch names in git sync messages
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Dec 16, 2015
1 parent 3256f1c commit 9a6d391
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions bin/git-sync
Expand Up @@ -36,11 +36,15 @@ fi

if [ -t 1 ]; then
RED=$'\e[31m'
LIGHT_RED=$'\e[31;1m'
GREEN=$'\e[32m'
LIGHT_GREEN=$'\e[32;1m'
RESET=$'\e[0m'
else
RED=""
LIGHT_RED=""
GREEN=""
LIGHT_GREEN=""
RESET=""
fi

Expand Down Expand Up @@ -105,7 +109,7 @@ git branch --list | \
else
git update-ref "refs/heads/${local_branch}" "$remote_branch"
fi
echo "${GREEN}Updated branch $local_branch (was ${local_sha:0:7}).${RESET}"
echo "${GREEN}Updated branch ${LIGHT_GREEN}${local_branch}${RESET} (was ${local_sha:0:7})."
else
# Local branch is ahead or diverged.
# TODO: Decide whether to try clean merge check + rebase here.
Expand All @@ -118,9 +122,9 @@ git branch --list | \
git checkout --quiet "$MASTER"
CURRENT_BRANCH="$MASTER"
fi
echo -n "$GREEN"
git branch -D "$local_branch"
echo -n "$RESET"
local_sha="$(git rev-parse "$local_branch")"
git branch -D "$local_branch" >/dev/null
echo "${RED}Deleted branch ${LIGHT_RED}${local_branch}${RESET} (was ${local_sha:0:7})."
else
echo "warning: \`$local_branch' was deleted on $ORIGIN, but appears not merged into $MASTER" >&2
fi
Expand Down

0 comments on commit 9a6d391

Please sign in to comment.