Created
December 28, 2009 18:05
-
-
Save albertsj1/264816 to your computer and use it in GitHub Desktop.
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
namespace(:branch) do | |
desc("show status of each branch") | |
task(:status_all) do | |
puts "Updating remote" | |
`git remote update` | |
x = `git br -a | grep -v remotes | tr -d ' ' | tr -d '*'` | |
y = x.split | |
goodbranchcount = 0 | |
badbranchcount = 0 | |
y.each do |thisbranch| | |
if system 'git diff --quiet #{thisbranch} origin/#{thisbranch}' | |
goodbranchcount += 1 | |
puts "Compared: git diff --quiet #{thisbranch} origin/#{thisbranch}" | |
else | |
puts "#{thisbranch}: Needs updating" | |
puts "Compared: git diff --quiet #{thisbranch} origin/#{thisbranch}" | |
badbranchcount += 1 | |
end | |
end | |
puts "#{goodbranchcount} branches up to date" | |
puts "#{badbranchcount} branches need updating" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment