Skip to content

Instantly share code, notes, and snippets.

@kevinjalbert
Created May 1, 2014 20:24
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 kevinjalbert/e60116f64f293e0fb6d8 to your computer and use it in GitHub Desktop.
Save kevinjalbert/e60116f64f293e0fb6d8 to your computer and use it in GitHub Desktop.
Show all of your git commits that happened since the last work day
#!/usr/bin/env ruby
require 'date'
COMMITTER = 'kevin.j.jalbert'
def last_work_day(date)
if date.monday?
(date.to_date - 3).httpdate
else
(date.to_date - 1).httpdate
end
end
def print_standup_results(dir)
results = `git --no-pager --git-dir #{dir}/.git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(green)<%an>%Creset' --abbrev-commit --date=relative --committer='#{COMMITTER}' --all --since="#{last_work_day(Date.today)}"`
if !results.empty?
puts "\n::#{dir}::"
puts results
end
end
puts "----------------------"
puts "::Git Standup Report::"
puts "----------------------"
if File.exist? "#{Dir.pwd}/.git"
print_standup_results(Dir.pwd)
else
Dir.glob('*').select do |dir|
if File.directory? dir
git_dir = "#{dir}/.git"
if File.exist? git_dir
print_standup_results(dir)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment