Last active
January 29, 2021 22:54
-
-
Save kas-cor/1b3f36e4f0256ce9280ad37640e6cd93 to your computer and use it in GitHub Desktop.
Finding and optimize repositories in 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
current_dir=$PWD | |
echo "Finding repositories in $current_dir" && echo | |
for repo in `find ${current_dir} | grep ".git$"` | |
do | |
echo "Repository ${repo%.git} size `du -hcs ${repo} | grep 'total\|итого'`" | |
cd ${repo%.git} && git gc > /dev/null 2>&1 | |
echo "Size after optimization `du -hcs ${repo} | grep 'total\|итого'`" && echo | |
cd ${current_dir} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install
Use