Skip to content

Instantly share code, notes, and snippets.

@MarkWarneke
Created July 19, 2020 11:03
Show Gist options
  • Save MarkWarneke/3600ce7bfadbf67d0af2012427103baa to your computer and use it in GitHub Desktop.
Save MarkWarneke/3600ce7bfadbf67d0af2012427103baa to your computer and use it in GitHub Desktop.
A quick and dirty folder based script to get the status and local branches of all repositories in the current folder
#!/bin/bash
BASEDIR=$(sh -c pwd)
for foldername in */; do \
cd $foldername && \
branch=$(git rev-parse --abbrev-ref HEAD) && \
lbranches=$(git branch)
echo "======= Status for $foldername --- branch: $branch =======" && \
git status
echo "------- local branches --------" && \
echo "$lbranches"
echo ""
cd $BASEDIR
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment