Created
September 27, 2012 18:57
-
-
Save mmorearty/3795756 to your computer and use it in GitHub Desktop.
Finds all git repos under the current directory, and does "git pull" on each
This file contains 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
#!/usr/bin/env ruby | |
# | |
# Finds all git repos under the current directory, and does "git pull" on each. | |
# | |
# To use this, you must first "gem install colored" | |
require 'colored' | |
def gitpull(dir) | |
dir = File.absolute_path(dir) | |
print "#{dir}\n".blue | |
Dir.chdir(dir) do | |
`git pull` | |
end | |
end | |
`find . -type d -name .git -print0`.split("\0").each { |dir| | |
gitpull("#{dir}/..") | |
} |
Sweet. Did not know about the colored
gem.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Advantages of using Ruby over Bash here: