Created
September 23, 2014 15:11
-
-
Save kchodorow/99195fcfdd97ea7ab29f to your computer and use it in GitHub Desktop.
See all git branches with descriptions and last commit date
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 | |
# Shows branches with descriptions | |
branches=$(git for-each-ref --format='%(refname)' refs/heads/ | sed 's|refs/heads/||') | |
for branch in $branches; do | |
last_used=$(git show --pretty=format:"%Cgreen%cr%Creset" $branch | head -1) | |
desc=$(git config branch.$branch.description) | |
if [ $branch == $(git rev-parse --abbrev-ref HEAD) ]; then | |
branch="*\t$last_used\t\033[0;32m$branch\033[0m" | |
else | |
branch="\t$last_used\t$branch" | |
fi | |
echo -e "$branch \033[0;36m$desc\033[0m" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment