Re: rebase -i: quick/inline reword
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- May 8, 2020, 00:05 UTC
- Message-ID
- <20200508000538.GE7234@camp.crustytoothpaste.net>
- In-Reply-To
- <87imh8m346.fsf@osv.gnss.ru>
On 2020-05-07 at 10:49:29, Sergey Organov wrote:
> It'd be really nice if it were possible to, say, search&replace in, or > spell-check, interactively, all the commit messages (including titles) > of a bunch of commits to be published, all in a single file handled by > single rebase run.
It is possible to do this with a bit of shell scripting. You can run "git rebase -x" if you want to check every commit in a certain way.
If instead you'd like to modify all the commit messages, you can use something like this:
GIT_SEQUENCE_EDITOR="sed -e 's/^pick /reword /'" \ GIT_EDITOR="some-shell-script-that-modifies-its-file-argument-in-place" \ git rebase -i BASE
I use something similar as an alias to automatically squash all my squash and fixup commits without needing to open an editor:
!f() { GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash "$@"; };f-- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204