Skip to content

Instantly share code, notes, and snippets.

@fairlight1337
Last active Aug 8, 2016
Embed
What would you like to do?
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)
#!/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
@fairlight1337

This comment has been minimized.

Copy link
Owner Author

@fairlight1337 fairlight1337 commented Aug 8, 2016

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.

@fairlight1337

This comment has been minimized.

Copy link
Owner Author

@fairlight1337 fairlight1337 commented Aug 8, 2016

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