gitのコミットログの修正

gitのコミットログの修正方法をどうしても忘れてしまう困ったちゃんなので備忘録として。

rebaseコマンドでHEADから2つ変更した場合。

git rebase -i HEAD~2

すると下記の用に表示されるはず。

pick <ハッシュ値> <コメント>
pick <ハッシュ値> <コメント>

# Rebase <ハッシュ値>..<ハッシュ値> onto <ハッシュ値>
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#

そしたらコメントで書いてあるCommandを参考にしてエディタを閉じる。


ま、要するに私が覚えれないコマンドはこの一行...

git rebase -i HEAD~2

はやく覚えよう...。