Skip to content

Instantly share code, notes, and snippets.

@Justintime50
Created April 6, 2021 02:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Justintime50/521ca7f41039b93b44c582ae928c4a9d to your computer and use it in GitHub Desktop.
Save Justintime50/521ca7f41039b93b44c582ae928c4a9d to your computer and use it in GitHub Desktop.
# Prints the local branches of your git repos to console. Perfect for helping clean up
#!/bin/bash
# Prints the local branches of your git repos to console. Perfect for helping clean up
# USAGE: git-branch-checker.sh "$HOME/git"
main() {
echo "Getting branches of each project"
check_git_branches "$1"
}
check_git_branches() {
cd "$1" || exit 1
for DIR in */ ; do
printf '%s\n' "$DIR"
cd "$DIR" && git branch
cd .. || exit
done
}
main "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment