LoginSignup
7
8

More than 5 years have passed since last update.

commit.cleanupの設定でgit commit時のコメント行が無視されなくなる

Last updated at Posted at 2013-04-03

コミットメッセージ中の行頭や行末の空白を git commit の際に削除してくれるオプションである

$ git config --global commit.cleanup whitespace

を設定するとコミット時の#から始まる行が無視されなくなります。

おそらくこの機能に対応していないバージョンであろう1.7.11.3だと下記のように表示されます


# 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:   Readme.md
#

1.8.2だと下記のように表示されます。


# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#>......modified:   Readme.md
#

この挙動が気に入らない場合は設定を削除するか、commit.cleanup = stripとする必要があります。

7
8
3

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
7
8