36
34

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GitHub のコミットログを日報がわりにする

Last updated at Posted at 2013-01-08
  1. 以下の nippo.rb をダウンロードしパスの通ったディレクトリに配置する
  2. GitHub のリポジトリを clone してきた作業ディレクトリで $ nippo.rb と実行する
  3. その日のコミットログメッセージが GitHub へのリンクつきで表示される

日報がわりにコピペすると便利です(サボってると一目瞭然なので真面目に仕事しようという気になります)

nippo.rb
#!/usr/bin/env ruby
 
remote = `git remote -v | grep origin | awk '{print $2}'`.split("\n").first.chomp.sub(/.*:(.*)/, '\1').sub(/\.git/, '')
puts "### #{remote} ###"
puts ""
`git log --after=yesterday --author='Kensuke Nagae'`.each_line do |line|
  puts line.gsub(/commit (\w+)/) {
    "commit https://github.com/#{remote}/commit/#{$1}"
  }
end

複数プロジェクトの作業ディレクトリを一箇所にまとめている場合は以下の nippo-all.rb を併用するとさらに便利です。

nippo-all.rb
#!/usr/bin/env ruby
 
Dir.glob("#{ENV['HOME']}/works/**").each do |dir|
  next unless File.exists?("#{File.expand_path(File.join(dir, '.git'))}")
  Dir.chdir(dir) do
    system("nippo.rb")
  end
end

36
34
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
36
34

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?