When you git rebase -i 1234abcd
, you get an editor session with the 'TODO' list for the rebase: What needs to be done for each relevant changeset.
Now, by default, we see one line per commit - the first line of the commit message. However, some of us write multi-line commit messages in which the first line doesn't say much.
Is it possible to somehow get git to print content from additional lines, in the TODO editor? I don't mind the exact format, I just need to distinguish the different commits to know what I'm doing.
Unfortunately, I do not think it is possible. The only way you can customize the rebase output is through
rebase.instructionFormat
configuration, like this:I tried with the option
%B
to return the subject with the body too, but the rebase operation fails with the following error:it seems like git considers the lines after the first one as executable code. I checked on the
git log
documentation, but among the--format
options I did not see anything that could replace the line feed with something else, or simply ignore it.At this point, you could clone your repo, run
git filter-branch
to replace line feeds with spaces for example, and eventually rungit rebase -i
.The interactive rebase does not consider the "third column", basically what you choose to log for a certain commit, so at the end you could copy and paste the output of the interactive rebase on the second repo (the one you
filter-branch
ed) inside the editor of your main repo.Anyway, I just found a question similar to yours.
EDIT: if you want another tool to take care of formatting the new commit message you can always create a script, like this one to replace line feed with
\n
and call it inside
--msg-filter
optionEDIT: I almost forgot that
filter-branch
recreates each commit that matches with the filter specified, so, before editing you should replace the commits column of the interactive rebase output in the cloned repo with the real commits in the main repo. It is getting more tedious than I imagined. Let's go back to simple things: we can simulate an interactive rebase without actually calling it. The script can be improved but I think the direction is the right one:you call it like this
and you obtain the interactive rebase output (kind of, without comments)