Skip to content

Instantly share code, notes, and snippets.

@mmorearty
Created September 27, 2012 18:57
Show Gist options
  • Save mmorearty/3795756 to your computer and use it in GitHub Desktop.
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
#!/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}/..")
}
@BMorearty
Copy link

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