How do I push amended commit to the remote Git repository?
问题 When I\'ve worked a bit with my source code, I did my usual thing commit and then I pushed to a remote repository. But then I noticed I forgot to organize my imports in the source code. So I do the amend command to replace the previous commit: > git commit --amend Unfortunately the commit can\'t be pushed back to the repository. It is rejected like this: > git push origin To //my.remote.repo.com/stuff.git/ ! [rejected] master -> master (non-fast forward) error: failed to push some refs to \'/