17
9

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

GitHub で issue を管理していると、コミットログで issue 番号を参照したくなる。

#1234 - Fix this issue ...

しかし、デフォルトで Git のコミットログは先頭が # から始まる行はコメントになるので、上記のように入力できない。そんなときは、Git の設定パラメータ core.commentChar を使ってコメント文字を変更する。

$ git config core.commentChar '>'

グローバルで変更を適用したかったら、--global を付けてもよい。

Vim のハイライト設定

Vimmer であれば、コメント文字を変更したら、vim のハイライト設定も変えたくなる。.vimrc に以下のように設定する。

au FileType gitcommit syntax match gitcommitComment /^[>"].*/

上記の設定では、# に加えて、>" がコメントとしてハイライトされるようになる。

参考

17
9
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
17
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?