I read this about how to amend commit messages. The accepted answer says:
If you've already pushed your commit up to your remote branch, then you'll need to force push the commit with
git push <remote> <branch> --force
.
It's my understanding (also from the accepted answer) that git push --force
will overwrite all data on the remote branch with the local one.
Why is force-pushing after changing a commit message necessary? What happens if I amend a commit message and try to push without -f
or --force
?