1
1

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 1 year has passed since last update.

Git 過去のコミットメッセージを変更する

Posted at

概要

  • push前の過去のコミットメッセージを変更する方法を簡単にまとめる。

方法

  1. 下記コマンドを実行してコミットメッセージを修正したいコミットが現在から何個前なのかを確認する。

    git log --stat
    
  2. 下記コマンドを実行してviを開く。

    git rebase -i HEAD~「何個前」の数値、2個前なら「2」になる
    
  3. 修正したいコミットの「pick」を「edit」に変更する。

  4. 保存する。

  5. 下記コマンドを実行してコミットを修正する。

    git commit --amend
    
  6. コミットメッセージの変更を行う

  7. 下記を実行して歴史をもとに戻す。

    git rebase --continue
    
1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?