Re: Non-interactively rewording commit messages
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Jun 30, 2022, 21:17 UTC
- Message-ID
- <Yr4S8jHKbtuBuT1z@tapette.crustytoothpaste.net>
- In-Reply-To
- <20220630152757.yxwhijvj5xoosrws@meerkat.local>
On 2022-06-30 at 15:27:57, Konstantin Ryabitsev wrote:
Show 19 quoted lines
> Hello, all: > > What's the best approach to non-interactively rewrite specific commit > messages? In this particular case, I am trying to automatically retrieve code > review trailers sent to the mailing list and put them into corresponding > commits. > > For example, I have a set of commits: > > abcabc: This commit does foo > bcdbcd: This commit does bar > cdecde: This commit does baz > > They were all sent to the mailing list and a maintainer sent a "Reviewed-by" > to the second commit. In a usual interactive rebase session this would be: > > pick abcabc > reword bcdbcd > pick cdecde
You can set GIT_SEQUENCE_EDITOR to a command which does this in-place on the file...
> When the edit screen comes up for the bcdbcd commit, the author would manually > stick the new trailer into the commit message. However, I can automate all > that away with b4 -- just need a sane strategy for non-interactively rewriting > entire commit messages at arbitrary points in the recent history.
...and you can set GIT_EDITOR to modify the commit message in-place in whatever way you want, and then use git rebase -i to rebase.
-- brian m. carlson (he/him or they/them) Toronto, Ontario, CA