LoginSignup
0
1

More than 5 years have passed since last update.

Git Commit後にコメントを変更

Last updated at Posted at 2019-04-05

[直前のもの]
git commit --amend

[直前のものではない場合]
1.
git rebase -i HEAD~n
を入力
・-iはCase Insensitiveの略
・-iはInteractiveの略
・nは取得するコメントの数。2個前のコメントを修正したい場合はnを2に変更して入力。

2.
Git rebase -i HEAD~3
と入力した場合、

pick e499d89 Delete CNAME
pick 0c39034 Better README
pick f7fde4a Change the commit message but push the same commit.

# Rebase 9fdb3bd..f7fde4a onto 9fdb3bd
#
# 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
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out 

と出力されるので、以下のように変えたいコメントの行のPickをRewordに変更する。

pick e499d89 Delete CNAME
reword 0c39034 Better README
reword f7fde4a Change the commit message but push the same commit.

変更を保存して閉じるとコメントを修正する画面になるので修正して保存する。

0
1
2

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