VOOZH about

URL: https://qiita.com/kyanny/items/4b677ef2d3276683e98e

⇱ GitHub のコミットログを日報がわりにする #Git - Qiita


👁 Image
36

Go to list of users who liked

34

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

More than 5 years have passed since last update.

@kyanny(Kensuke Nagae)

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

36
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

Go to list of users who liked

34
0

Go to list of comments

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

Go to list of users who liked

34