Magit - rename last commit
Asked Answered
R

2

9

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.

Rockafellow answered 2/10, 2015 at 8:14 Comment(0)
M
16

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

Monotype answered 2/10, 2015 at 9:5 Comment(0)
H
11

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.

Hawserlaid answered 6/10, 2018 at 8:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.