I want to reword multiple (a lot) of commits in a git repository.
When I execute the following command:
git rebase --interactive HEAD~200
I get the following 'ui' in vim:
1 pick 0c511d9 foo
2 pick da36f6f bar
3 ...
I might edit the vim buffer to look like this:
1 reword 0c511d9 foo_changed
2 reword da36f6f bar_changed_too
3 ...
Now, when I confirm using :wq, git will pull up each individual commit in a new vim buffer.
Worse than that, it will not even remember the modifications I did to the messages
but show only the original messages.
Is there a way to just reword in the initial vim buffer the way I did, without having to reconfirm everything again?
I'm was hoping for some magical flag like git rebase -i --inline-no-confirm.
I saw this question, but that's not quite what I want, because I still need the editor initially.
I ended up writing the following convenience script which does what I described:
I called this
git-batch-reword.sh. While it worked great for me, it's obviously a bit dangerous, so make sure to have a backup before blindly using this.This currently drops everything after the first line of all shown commit messages because of the
head -n 1in the filter. If anybody knows a nice trick to work around that, please leave a comment.