Created
January 31, 2020 00:57
-
-
Save dinhvh/8dd2f851536f8659af0d91d270ef1050 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 | |
branch_name="$(git rev-parse --symbolic-full-name --abbrev-ref HEAD)" | |
bold="$(tput bold)" | |
normal="$(tput sgr0)" | |
echo "${bold}Current branch: $branch_name${normal}" | |
echo "" | |
git for-each-ref --sort='-committerdate' --format='%(objectname:short) | %(committerdate:human) | %(refname)' refs/heads | sed -e 's/refs\/heads\///' | head -n 20 | while read line ; do | |
line_branch="$(echo $line|sed -e 's/.* | .* | \(.*\)/\1/')" | |
if test $line_branch = $branch_name ; then | |
echo "${bold}$line${normal}" | |
else | |
echo "$line" | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment