Skip to content

Instantly share code, notes, and snippets.

@dtan4
Created October 11, 2013 08:48
Show Gist options
  • Save dtan4/6931659 to your computer and use it in GitHub Desktop.
Save dtan4/6931659 to your computer and use it in GitHub Desktop.
Scan repositories and alert if unpushed commits exist
#!/usr/bin/env ruby
root = Dir.pwd
Dir.glob("*").map { |d| File.expand_path(d, root) }.each do |dir|
next unless File.ftype(dir) == "directory"
Dir.chdir(dir)
unpushed = `git rev-list origin/master..master 2>/dev/null | wc -l | tr -d ' '`.to_i
puts "#{dir} [#{unpushed}]" if unpushed > 0
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment