8

How do I rename the last commit in Magit (ie. edit the commit message) ?

I can see it in magit-log-buffer-file, but I don't know how to interact with it.

nha
  • 17,623
  • 13
  • 87
  • 133

2 Answers2

15

Press c (Commit), then a (Amend), edit the message, C-c C-c, profit!

choroba
  • 231,213
  • 25
  • 204
  • 289
10

There is a command called magit-commit-reword in latest Magit(Current version:v2.13.0)

Steps:

  1. Press c (Commit) at commit. (I usually move cursor to the first line after typing magit-status command)
  2. Press w (Reword)
  3. Rename
  4. Press C-c C-c to commit
  5. Done

Magit manual can be found here: https://magit.vc/manual/magit.html (Search reword in the page)

c w (magit-commit-reword)

Reword the last commit, ignoring staged changes. With a prefix argument keep the committer date, otherwise change it. The option magit-commit-reword-override-date can be used to inverse the meaning of the prefix argument.

frankyxhl
  • 101
  • 1
  • 5