LoginSignup
1
0

More than 5 years have passed since last update.

#からはじまるメッセージを持つコミットを対話式で修正したいとき

Last updated at Posted at 2016-10-13

コミット漏れやメッセージ内容の修正で git commit --amend で対話形式で修正するときに、#1234 のようなチケット番号を先頭にいれているときのやり方のメモ。

デフォルトだと、#はコメントアウトの記号になるので、このままではうまくいかないです。

  1. --cleanup=whitespace を追加
  2. git config core.commentchar ";" などとしてコメントアウトの記号をかえる
  3. git commit --amend -m "#1234 hogehoge" として対話式をあきらめる

--cleanup=whitespace でコメント行を無視してメッセージを整形(余計なものを消す)する設定です。これをやると、先頭以外にもあるコメント行もメッセージとして採用されてしまうので注意が必要です。

参考サイト

1
0
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
1
0