With git rebase, is there a way to reword commit messages in the git-rebase-todo using the default commands?
You can probably use the exec
option to achieve what you want.
Use an exec command similar to git commit --amend -m "this is the new message"
You can either use that directly, or if you need more sophistication put it in an external script called my_reword
.
#!/bin/sh
git commit --amend -m "$1"
Then add in the exec
line wherever you want
pick 6b24464 foo
pick a681432 Foo
x my_reword "this is a new message"
pick 8ccba08 foo foo
I do not believe that can be done, because when you do a git rebase -i
you get only the first line of each commit message, not the full commit message.
As a convention, a commit message should have the first line be only a summary, and have more details about the change in the following lines. Here's Linus Torvalds on how to write a proper commit message
Also, please write good git commit messages. A good commit message looks like this:
Header line: explain the commit in one line (use the imperative) Body of commit message is a few lines of text, explaining things in more detail, possibly giving some background about the issue being fixed, etc etc. The body of the commit message can be several paragraphs, and please do proper word-wrap and keep columns shorter than about 74 characters or so. That way "git log" will show things nicely even when it's indented. Make sure you explain your solution and why you're doing what you're doing, as opposed to describing what you're doing. Reviewers and your future self can read the patch, but might not understand why a particular solution was implemented. Reported-by: whoever-reported-it Signed-off-by: Your Name <[email protected]>
where that header line really should be meaningful, and really should be just one line. That header line is what is shown by tools like gitk and shortlog, and should summarize the change in one readable line of text, independently of the longer explanation. Please use verbs in the imperative in the commit message, as in
Fix bug that...
,Add file/feature ...
, orMake Subsurface...
So, even though you may have done only one line of message per commit, this is not what git is assuming, so it won't let you edit a commit message through a "one line per commit view".