Run git gc on multiple repositories

Viewed 2944

I have a git repository root at /git

There are different depth of paths, such as:

/git/project/project1/module1.git
/git/project/project1/module2.git
/git/project/project2/dev/module1.git
/git/library/libgit2.git
/git/library/jquery/jquery.git

How to I run git gc recursively in all repos inside /git?

I would prefer to use a shell script to iterate over the repositories: If that directory is not a valid git repository, do not run git gc.

3 Answers
Related