$ git log -1 --name-only
NodeJSで最新のコミットログから、コミットしたファイルの一覧を取得する
CoffeeScript
exec = require 'exec'
exec 'git log -1 --name-only', (obj, log)->
lines = log.split('\n')
commit = lines.shift().replace(/^commit /, '')
author = lines.shift().replace(/^Author:\s+/, '')
date = lines.shift().replace(/^Date:\s+/, '')
lines.shift()
files = []
while true
file = lines.pop()
if file
files.unshift(file)
else
break
comment = lines.join('\n')
comment = comment.replace(/^\s{4}/g, '')
item =
commit: commit
author: author
date: new Date(date)
files: files
comment: comment
console.log JSON.stringify(item, null, ' ')