Created
November 12, 2013 08:27
-
-
Save yurikoval/7427470 to your computer and use it in GitHub Desktop.
Fetch all remote git update for your repos in your dev folder recursively
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
| #!/usr/bin/ruby | |
| def is_git_repo | |
| %x[git rev-parse 2>&1] | |
| $?.exitstatus == 0 | |
| end | |
| dir_to_scan = if ARGV[0] | |
| if ARGV[0] !~ /^\// | |
| "#{Dir.pwd}/#{ARGV[0]}" | |
| else | |
| ARGV[0] | |
| end | |
| else | |
| Dir.pwd | |
| end | |
| repos = Dir.entries(dir_to_scan).select {|f| File.directory? f} | |
| repos.each do |d| | |
| Dir.chdir "#{dir_to_scan}/#{d}" | |
| if is_git_repo | |
| puts "Updating #{d}." | |
| %x[git remote update] | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment