Open a terminal and write this
git rebase -i HEAD~n
n is the commit size(example n=3 if you want to change the last 3 commit messages.)
then replace pick keyword with reword and save and close the commit list file.
After each reword keyword you wrote, will see the commit files and you can change the commit messages.
When you’re ready to push your changes just write this code
git push --force origin branch_name
–force means force push over the old commits.