Skip to content

Instantly share code, notes, and snippets.

@esad
Created February 13, 2009 19:47
Show Gist options
  • Save esad/64064 to your computer and use it in GitHub Desktop.
Save esad/64064 to your computer and use it in GitHub Desktop.
#!/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 <esad@esse.at> 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