Save the rebase file, and git will drop back to the shell and wait for you to fix that commit.

Add your file with git add.

Amend the commit with git commit --amend.

Do a git rebase --continue which will rewrite the rest of your commits against the new one.

To change the commit message for either of these

While this method is mainly for changing files and the commit messages will default to the initial commit message, you can also change the commit message explicitly by adding an -m flag: git commit --amend -m "New commit message".

git commit --amend’s equivalent

According to the official docs, the ammend command is also the same as:

git reset --soft HEAD^
# do something else to come up with the right tree ...
git commit -c ORIG_HEAD