Search code examples
gitversion-controlgit-rebase

git interactive rebase: reword without confirming each commit


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.


Solution

  • You can run a command to reword the message in your git-rebase-todo buffer with the x (or exec) tag. It's a bit clunky, but I guess an alias can vastly improve things if you do this often.

    e.g.

    1. pick c389131 bad message
    2. x git commit --amend -m'better msg'
    3. pick abcd123 ...