Amending a commit generates a new commit. If you have already pushed the (previous version of the) commit to a remote repository, you cannot push the new commit without -f
because that would alter the existing history of the remote. A key promise that git makes is that a given commit -- and the history leading up to that commit -- cannot be modified without generating a new commit id.
Your options are:
- Just use
git push -f
and let people know, or
- Create a new commit after the existing one and push that.
Some workflows (for example, those involving Gerrit or GitHub pull requests) rely on forced pushes as a regular operation (e.g., for updating an existing pull request). Adopting a workflow like this can give you more opportunities for fixing things "after the fact".