#blog
[https://dhwthompson.com/2019/my-favourite-git-commit](https://dhwthompson.com/2019/my-favourite-git-commit)
筆者が好きなコミットメッセージについて書いているもので以下の理由から「良い」コミットメッセージであると評価している
該当のコミットは
[https://github.com/alphagov/govuk-puppet/commit/63b36f93bf75a848e2125008aa1e880c5861cf46](https://github.com/alphagov/govuk-puppet/commit/63b36f93bf75a848e2125008aa1e880c5861cf46)
> Convert template to US-ASCII to fix error
> I introduced some tests in a feature branch to match the contents of
> `/etc/nginx/router_routes.conf`. They worked fine when run with `bundle exec
> rake spec` or `bundle exec rspec modules/router/spec`. But when run as
> `bundle exec rake` each should block failed with:
>
> ArgumentError:
> invalid byte sequence in US-ASCII
>
> I eventually found that removing the `.with_content(//)` matchers made the
> errors go away. That there weren't any weird characters in the spec file. And
> that it could be reproduced by requiring Puppet in the same interpreter with:
>
> rake -E 'require "puppet"' spec
>
> That particular template appears to be the only file in our codebase with an
> identified encoding of `utf-8`. All others are `us-ascii`:
>
> dcarley-MBA:puppet dcarley$ find modules -type f -exec file --mime {} \+ | grep utf
> modules/router/templates/routes.conf.erb: text/plain; charset=utf-8
>
> Attempting to convert that file back to US-ASCII identified the offending
> character as something that looked like a whitespace:
>
> dcarley-MBA:puppet dcarley$ iconv -f UTF8 -t US-ASCII modules/router/templates/routes.conf.erb 2>&1 | tail -n5
> proxy_intercept_errors off;
>
> # Set proxy timeout to 50 seconds as a quick fix for problems
> #
> iconv: modules/router/templates/routes.conf.erb:458:3: cannot convert
>
> After replacing it (by hand) the file identifies as `us-ascii` again:
>
> dcarley-MBA:puppet dcarley$ file --mime modules/router/templates/routes.conf.erb
> modules/router/templates/routes.conf.erb: text/plain; charset=us-ascii
>
> Now the tests work! One hour of my life I won't get back..
## 好きな理由
### It explains the reason for the change
[https://twitter.com/t_wada/status/904916106153828352](https://twitter.com/t_wada/status/904916106153828352)
> コードには How
> テストコードには What
> コミットログには Why
> コードコメントには Why not
>
> を書こうという話をした
に近い話で、変更がなぜ発生したのかが説明されている
### It's searchable
`git log --grep "invalid byte sequence"` などで検索性がある
### It tells a story
この変更の結論に至ったプロセスなどが書いてある
### It makes everyone a little smarter
ここは「言われてみればそうだな」となってポイントだなとなった
このコミットメッセージを読んだ人が何かしらの知識を得て少しでも学びがあるというのは意識していきたい
### It builds compassion and trust
> Now the tests work! One hour of my life I won't get back..
こういう人間性を出す部分も良いと言っているが自分はあんまりそうは思わないのでここは意見が分かれそう