Using Rake and Git to find out what I did yesterday
At our daily stand-ups we have to answer the question "What did you do yesterday". I wrote a little Rake task for the project I am working on to help me answer:
desc "List of all commits commited in the previous 24hours" task :yesterday do git_author = ENV['GIT_AUTHOR'] || "chris.lowis" cmd = "git --no-pager log --after=\"1 day ago\" --pretty=oneline --author=#{git_author}" puts "Commits in the last 24 hours for #{git_author}" system(cmd) end
This simply shells out to git with the appropriate command line arguments giving me a simple list:
Commits in the last 24 hours for chris.lowis
6663b95b5832sda91998c05fea7970fe44da13af Adding a great new feature
677b2e8092406b3c2031e8f065fg5672d90b8108 Fixing someone elses bug
There's quite a lot of interesting options that you can pass to git log
, see the documentation for a list of them.