248
205

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 --amendでコミットメッセージを修正

Posted at

git commit -m "hogehoge"とした後に、さっきのコミットログを修正したい!と思った時にはgit commit --amendを使う。

$ git commit -m "hogehoge"
$ git log

# commit 01afc1b0c5d25302625ca64dc0f6682ad21526f5
# Author: author <author@mail.com>
# Date:   Mon Aug 17 16:21:26 2015 +0900
#
#    hogehoge

$ git commit --amend

# エディタが開くので、そこで「hogehoge」を「fugafuga」に修正して保存

$ git log

# commit 01afc1b0c5d25302625ca64dc0f6682ad21526f5
# Author: author <author@mail.com>
# Date:   Mon Aug 17 16:21:26 2015 +0900
#
#    fugafuga

また、これと同様にコミットメッセージを修正したい場合、git commit --amend -m "fugafuga"としても修正することができます。(コミットメッセージの修正だけが目的ならこっちのほうがいいかも?)

248
205
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
248
205

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?