Git – Getting a birds eye view of what branch your repositories are on

  • This is an old post that I didn’t finish. I’m putting it up out of prosperity

A quick script to enable birdseye view of what branch various repositories are residing on.

cat listrepos.sh

#!/bin/bash

REPOS=” `find $HOME/somepath* -maxdepth 1 -mindepth 1|xargs -l echo`”

GIT_DIRS=${REPOS}

for d in $GIT_DIRS

do

if [ -d $d/.git ]; then

cd $d

REPO=${d##*/}

BRANCH=`git rev-parse –abbrev-ref HEAD`

echo $REPO $BRANCH

fi

done

example output

[email protected]:~$ ./listrepos.sh

repoa development

repob development

repoc master

repod featurebranch