1

From this question, I know it is possible to prefix/modify all commits from a git-interactive-rebase.

But is it possible to modify all to-be-renamed commits messages in a single action? For instance when you select the reword command to just take the modified message from that editor?

It is not only prefixing or replacing something. It is arbitrary modifications that can only be manually done

Gonzalo Matheu
  • 8,984
  • 5
  • 35
  • 58

1 Answers1

2

Rebase is usually a manual process, but there are some Unix-y ways of automating it:

Try setting $EDITOR to a sed command before running your rebase --continue. For example:

git rebase -i ...

Replace the first line's pick with edit or e, then the rest of the lines with reword or r.

Save-exit, then run:

export EDITOR="sed -i -e 's/foo/bar/g'"
git rebase --continue

This'll replace all instances of foo in the commit message with bar.

amphetamachine
  • 27,620
  • 12
  • 60
  • 72
  • 1
    AFIU the OP asks a slightly different question — how to make `git rebase` to use texts after `reword` in the TODO file as the commit messages. – phd Feb 14 '23 at 23:31