Last active
September 5, 2023 07:53
-
-
Save cnjimbo/169bc8b3d4d16eb405c2b04939a8129c to your computer and use it in GitHub Desktop.
sh gists
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 | |
# 循环子目录,收缩git目录。清理历史记录,删除未引用提交, | |
# 并执行git reset --hard | |
for dir in */; do | |
cd "$dir" | |
if [ -d .git ]; then | |
echo "Resetting $dir" | |
git reset --hard | |
git prune | |
git gc | |
git clean -xfd | |
fi | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment