When I use git commit --amend or git rebase -i, vim opens up for me to make changes. If I then change my mind and exit vim without making any chang
When you haven't made changes and saved them, :q! could suffice (in a plain commit; when you're not amending), but if you are like me, chances are you've already (even unconsciously) persisted the edited message.
Git (and other such tools that use Vim to edit a message) will abort the entire process (and ignore any saved changes to the message) if the editor quits with a non-success exit status. You can do that in Vim with the :cq[uit]! command.
You may want to use cq without ! if you want vim to exit with an error and without saving.