Skip to content

Instantly share code, notes, and snippets.

@stekycz
Created February 28, 2017 10:40
Show Gist options
  • Save stekycz/5571b2bd9beab253a2db281559aaae9e to your computer and use it in GitHub Desktop.
Save stekycz/5571b2bd9beab253a2db281559aaae9e to your computer and use it in GitHub Desktop.
Runs GC and prune in all GIT repositories in given path except PHP composer vendor directories and node_modules
#!/bin/bash
root=$1
current_dir=`pwd`
for file in `find $root -not -path "*vendor*" -not -path "*node_modules*" -name ".git"`; do cd $file/..; echo `pwd`:; echo; git gc; git prune; git gc; echo; done
cd $current_dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment