Created
August 18, 2011 00:31
-
-
Save mipearson/1153008 to your computer and use it in GitHub Desktop.
find git repositories that are behind their current remote tracking branch
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 | |
pwd = ARGV[0] || '.' | |
debug = ARGV[1] == '-d' | |
Dir[File.join(pwd, '**', '.git')].each do |repo| | |
repo.gsub!(/\.git$/, '') | |
$stderr.puts "in #{repo}" if debug | |
if `cd #{repo}; git status`.include?("Your branch is ahead of") | |
puts repo | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment