Created
February 13, 2009 19:47
-
-
Save esad/64064 to your computer and use it in GitHub Desktop.
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/ruby | |
# | |
# Recursive git pull - will go into first-level subdirectories that are git repos and execute "git pull", stopping on first unsuccessful pull | |
# @Copyleft 2009 Esad Hajdarevic <[email protected]> http://dev.soup.io/ | |
repos = Dir["*/.git"].map {|path| path.chomp!("/.git") } | |
if repos.empty? | |
puts "No git repositories found" | |
else | |
if ARGV.include?("--list") | |
puts repos.join("\n") | |
exit | |
end | |
repos.each do |path| | |
cmd = "cd #{path} && git pull" | |
puts "-- #{cmd} ".ljust(80,'-') | |
puts `#{cmd}` | |
if $?.to_i != 0 | |
#puts "rgp terminated" | |
exit | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment