The git push command uploads local repository content to a remote repository.
The git commit command saves the repository changes in local machine but not remote repository. By contrast Git push then updated the git commit changes and sends it to remote repository. It helps the developers for access them.
Lets see how to change a Git commit message after a push:
git commit --amend
Use the above command if it is the most recent commit.
This instruct the editor with the last commit message and lets you edit the message. (You can use -m if you want to wipe out the old message and use a new one.)
After that you push using the following commands
git push --force-with-lease <repository> <branch>
If somebody pushed changes to the same branch and you likely want to avoid spoiling those changes. The --force-with-lease option is the safest, because it will abort if there are any upstream changes.
git push <repository> +<branch>
git push --force <repository> <branch>
If you don't specify the branch exactly, Git will use the default push settings. If your default push setting is "matching", then you may destroy changes on several branches at the same time.