Created
October 30, 2017 14:09
-
-
Save davidpdrsn/c1caa66131105b3f86b3d790b328b5b4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| require "active_support/core_ext/date" | |
| require "pp" | |
| def extract_date(line) | |
| regex = /HEAD@{(?<date>[^}]+)}/ | |
| return unless line =~ regex | |
| line.match(regex)[:date] | |
| end | |
| lines = `git reflog --date=iso`.lines.map(&:chomp) | |
| lines_from_today = lines.select do |line| | |
| date_string = extract_date(line) | |
| next unless date_string | |
| date = Date.parse(date_string) | |
| date.today? | |
| end | |
| puts "# Todays commits\n\n" | |
| puts lines_from_today.grep(/commit/) | |
| .map { |line| line.split(": ").last } | |
| .map { |line| "- #{line}" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment