Created
November 22, 2009 17:54
-
-
Save dysinger/240648 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| namespace(:git) do | |
| def all | |
| `find . -name .git -type d`.reject {|d| d =~ /.hudson.*/}.each do |prj| | |
| Dir.chdir(File.dirname(File.expand_path(prj))) do |d| | |
| puts(d) | |
| begin | |
| yield | |
| rescue Exception => e | |
| puts(e.message) | |
| end | |
| end | |
| end | |
| end | |
| desc "update all repos" | |
| task(:update) do | |
| all do | |
| `git remote update` | |
| `git svn fetch` unless `git config --get svn-remote.svn.url`.empty? | |
| end | |
| end | |
| desc "prune all remotes" | |
| task(:prune) do | |
| all do | |
| `git remote`.each do |r| | |
| `git remote prune #{r}` | |
| end | |
| end | |
| end | |
| desc "gc all repos" | |
| task(:gc) do | |
| all do | |
| `git gc --aggressive` | |
| end | |
| end | |
| desc "rm deleted files" | |
| task(:rm) do | |
| `git status`.split("\n").each do |l| | |
| l =~ /^#\s+deleted:\s+(.*)/ && `git rm #{$1}` | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment