LoginSignup
533
537

More than 5 years have passed since last update.

git commit時に英語でメッセージ書くためのヒントを表示する

Last updated at Posted at 2016-01-07

はじめに

英語力をあげるために、コミットメッセージを英語で書こうとしても実践するのはなかなか難しいものです。

GitHubで使われている実用英語コメント集 - Qiita のような記事を読んでもコミットするときには忘れています。

そこで、git commit時に表示されるコメントに、英語でメッセージを書くためのヒントを表示してみました。

完成イメージ

image

やり方

~/.gitmessage.txt を作成

~/.gitmessage.txt


# fix, add, changeといった事実ではなく、このcommitで実現する要件や仕様を書きましょう。(リファクタなどは除く)
# 
# 例文)
# - Fix typo in docs
# - Remove unused code
# - Remove use of deprecated method
# - Update Modernizr to v1.6
# - Make it possible to have IDs per request
# - Make sure to reset default_url_options(必ずリセットする)
# - Don't use "assert_not_nil"
# - Allow the user to drag faster
# - Remove methods to avoid warnings.

commit.template に設定

git config --global commit.template ~/.gitmessage.txt

これで、git commit時に英語で書くためのヒントが表示されます! 例文は GitHubで使われている実用英語コメント集 - Qiita からピックアップしました。

英語以外にも良いコミットメッセージを書くためのヒントも表示できます。例文の上に書いたのは、Git - 提言: コミットメッセージの一行目には要求仕様を書け - Qiita を参考にしています。

おわりに

英語力アップしたいけど、言うは易し行うは難しなので、小さいところから英語を書きやすくする環境を整えていきましょう!

533
537
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
533
537