Created
November 11, 2020 06:51
-
-
Save MatthiasLohr/692d2dd57612a08b07a779c9883e521b to your computer and use it in GitHub Desktop.
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/sh | |
# (c) by Matthias Lohr <[email protected]> 2014 | |
# Read LICENSE file for license information. | |
CURDIR="$(pwd)" | |
if [ "$1" = "" ] ; then | |
REPOSDIR="$CURDIR" | |
else | |
REPOSDIR="$1" | |
fi | |
FILES_BEFORE=$(find "$REPOSDIR" -type f | wc -l ) | |
SPACE_BEFORE=$(du -sh "$REPOSDIR") | |
echo Current: $SPACE_BEFORE in $FILES_BEFORE files | |
for ITEM in $(find "$REPOSDIR" -type d -name "*.git") ; do | |
echo "Cleaning up $ITEM..." | |
cd "$ITEM" | |
git gc --aggressive | |
cd "$CURDIR" | |
done | |
FILES_AFTER=$(find "$REPOSDIR" -type f | wc -l ) | |
SPACE_AFTER=$(du -sh "$REPOSDIR") | |
echo Before: $SPACE_BEFORE in $FILES_BEFORE files | |
echo Now: $SPACE_AFTER in $FILES_AFTER files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment