Created
April 6, 2021 02:54
-
-
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
This file contains 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 | |
# 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