Created
March 1, 2023 14:17
-
-
Save ahgraber/4b2dd01a32d030ab7154098cf39ed037 to your computer and use it in GitHub Desktop.
Get lines of code across multiple repos
This file contains hidden or 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 | |
## assumes "multiple repos" are all in the same parent directory, which is also the current working directory | |
# set up git | |
for dir in ./*/; do | |
dir=${dir%*/} # remove the trailing "/" | |
cd "$dir" | |
echo "$dir" | |
git fetch -p && git pull | |
# select branch if required | |
# git branch ... | |
cd .. | |
done | |
# get counts of files & lines | |
for dir in ./*/; do | |
dir=${dir%*/} # remove the trailing "/" | |
cd "$dir" | |
echo "$dir" | |
git diff --shortstat "$(git hash-object -t tree /dev/null)" | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment