127
108

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

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

Posted at

コミットテンプレート

  • 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
#
127
108
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
127
108

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?