Last active
August 8, 2016 07:24
-
-
Save fairlight1337/84bb2643942bd497bd470e605564b301 to your computer and use it in GitHub Desktop.
A script I put into my $PATH and use for quickly listing the currently selected branches of all subdirectories (rather than going through them one by one)
This file contains hidden or 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 | |
MASTER="master" | |
for item in $(ls -1); do | |
if [ -d $item ]; then | |
cd $item | |
if [ -d .git ]; then | |
branch=`git rev-parse --abbrev-ref HEAD` | |
if [ "$branch" != "$MASTER" ]; then | |
color=$'\033[37;3m' | |
else | |
color=$'\033[92;3m' | |
fi | |
printf "%s%-35s : %s%s\n" $color $item $branch $'\033[39;0m' | |
fi | |
cd .. | |
fi | |
done |
Colors master in light green, everything else in white.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Saves me both, time and being prone to get lost in couple of dozen directories while seeing which repositories need tending to at the moment.