16
17

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 commit -mで簡単に3行コメントを残す方法

Last updated at Posted at 2018-11-01

複数行のコミットメッセージを書く際、viエディタを使用せずに、3行コメント(複数行コメント)を残す方法はないか?と調べていた際の忘備録です。

gitコマンド

$ git commit -m"1行目メッセージ" -m"2行目メッセージ" -m"3行目メッセージ"

これだけです。

具体例

今回は下記のようにコミットメッセージを残してみました。

1行目:要約
2行目:空白
3行目:詳細

Screen Shot 2018-11-01 at 7.19.00 PM.png

$ git log で確認してみると、↑のように表示されます。

もしコミットメッセージを間違えて入力してしまった時

$ git commit --amend -m"1行目の訂正内容" -m"2行目の訂正内容" -m"3行目の訂正内容"

ただし、これは直前のコミットに対してのものなので注意してください。


以上です。
素敵なGit操作をお楽しみください。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?