3

What if I forget to sign-off my last commit, how can I fix the last commit within Magit?

I can do that with git command:

$ git commit --signoff --amend 

Of cause I can write the sign-off by hand in the rebase reword buffer, but does Magit provide easy way to do?

1 Answer 1

4

Changing the last commit message

What you are wanting to do is change (rewrite) the last commit message to add the signed-off line.

Go to the git status window (a common key binding is C-x g)

type c to get into commit

type -s to enable the signed-off line

type w to reword the last commit message, check that you have the wanted signed-off field.

type C-cC-c to do the commit

To enable -s as the default

You can set the -s option as the default by

type c to go to commit

If needed, type C-t to enable the common options

type -s to toggle the signed-off, toggle other options as desired.

type C-cC-c to set the defaults.

3
  • I somehow didn't realize that amending is commit command. It's exactly what I type in the command line. git commit --signoff --amend. It's just that magit is better than git, and using reword, which translates to --amend --only. Commented Mar 8, 2018 at 11:46
  • C-t isn't bound to anything when using magit. Am I missing something? Thanks! Commented Jun 14, 2022 at 13:43
  • 1
    @RickyRobinson C-t is bound to transient-show for me. I see from other answers that magit has advanced in the last 4 years, and I don't seem to need the C-t currently. Commented Jun 15, 2022 at 17:22

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.