Last active
December 5, 2016 12:05
-
-
Save kbingham/b97d9a181e72191494619a9b46439ee4 to your computer and use it in GitHub Desktop.
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 | |
## Derived from : http://stackoverflow.com/questions/2108405/branch-descriptions-in-git | |
## answered May 23 '13 at 9:21 ## jsageryd | |
# Shows branches with bases | |
function gb() { | |
branches=$(git for-each-ref --format='%(refname)' refs/heads/ | sed 's|refs/heads/||') | |
head=$(git rev-parse --abbrev-ref HEAD) | |
for branch in $branches; do | |
base=$(git describe --abbrev=0 $branch 2>/dev/null) | |
if [ $branch == $head ]; then | |
branch="* \033[0;32m$branch\033[0m" | |
else | |
branch=" $branch" | |
fi | |
echo -e "$branch \033[0;36m$base\033[0m" | |
done | |
} | |
gb | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment