How to delete previos commit and add new commit to the same file with different commit message

How to delete previos commit and add new commit to the same file with different commit message

If you simply want to edit the commit message then use this:

git commit --amend