Skip to content

Instantly share code, notes, and snippets.

@vbjay
Created October 12, 2015 05:08
Show Gist options
  • Save vbjay/6ffb946594567f3d9fdf to your computer and use it in GitHub Desktop.
Save vbjay/6ffb946594567f3d9fdf to your computer and use it in GitHub Desktop.
gc and update all git repos located in current folder and subfolders.
#!/bin/bash
function procgit {
git count-objects -vH;
echo
git fetch --all
echo
git gc
git count-objects -vH
echo
}
export -f procgit
find "$(pwd)" -name .git -type d | while read d; do
cd "$d/.."
echo "$d"
procsubmod
git submodule foreach --recursive procgit
cd "$OLDPWD"
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment