Skip to content

Instantly share code, notes, and snippets.

@albertsj1
Created December 28, 2009 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save albertsj1/264816 to your computer and use it in GitHub Desktop.
Save albertsj1/264816 to your computer and use it in GitHub Desktop.
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