Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
105
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

Organization

Git のコミットメッセージをテンプレート化する

コミットテンプレート

  • git のコミットメッセージをある程度フォーマット化したい場合、コミットテンプレートを用意できる
  • プロジェクト内でコミットメッセージの書き方を統一したい場合に便利

テンプレートファイルの用意

  • 任意の場所にテンプレートファイルを用意し、git config でそのファイルをセットする
$ touch ~/.gitmessage.txt
$ git config --global commit.template ~/.gitmessage.txt
.gitmessage.txt
[ticket: #xxxx][Task/Bug] Subject line

what happened
ref : ticket link

使用例

$ git commit

[ticket: #xxxx][Task/Bug] Subject line

what happened
ref : ticket link

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
# modified:   hoge/test.txt
#
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
105
Help us understand the problem. What are the problem?