As EmmaBostian said:

If it makes you feel any better… nobody actually knows how to use Git. We all just memorize a few shell commands and hope nothing implodes.

The post How to Change a Git Commit Message helped me to change the commit messages on previous commits. A word of caution: rebase rewrites the commit history. It is strongly discouraged to rebase commits that are already pushed remote/origin.

To change the message of any of the last 5 commits, execute the following command which will display the latest 5 commits in the editor.

git rebase -i HEAD~5

In the editor replace pick with reword of the messages, you would like to change.

pick 43f8707f9 Updates FooTest
reword cea1fb88a Removes baz
reword aa540c364 Adds foo and bar
pick c5e078656 Fixes CS
pick 11ce0ab34 Updates dependencies

# Rebase 7e59e8ead..11ce0ab34 onto 7e59e8ead (5 commands)

Push the changes.

git push --force