Created
March 11, 2024 17:14
-
-
Save david-bakin-sl/5a05875206bef43e0cffa6a3dfe64dd7 to your computer and use it in GitHub Desktop.
Show current branch of all repos under current directory
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
#!/usr/bin/env bash | |
# Show current branch for all repos under current directory (avoids submodules) | |
for repo in $(find . -type d -execdir test -d {}/.git \; -prune -print | sed 's/^\.\///g' | sort); | |
do | |
cd $repo | |
branch=$(git branch --show-current) | |
echo "$repo = $branch" | |
cd $OLDPWD | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cd -
changes to the previous directory.