Skip to content

Instantly share code, notes, and snippets.

@brimston3
Created April 19, 2019 13:17
Show Gist options
  • Save brimston3/cadc234ffb630c44bd565c41280d14d2 to your computer and use it in GitHub Desktop.
Save brimston3/cadc234ffb630c44bd565c41280d14d2 to your computer and use it in GitHub Desktop.
gc repack prune all visible git working repositories
#!/bin/zsh
# Can't figure out how this works or why you might want to do this? Don't do it.
# Don't. Do. It.
pushd
locate -b '\.git' | while read -t 1 repo
do
cd "$(dirname "$repo")"
git gc
git repack -Ad
git prune
done
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment