Each commit in Git is identified by a hash.
As it happens, you push a first commit with a specific hash. Then you change its hash by distorting the commit (with the git commit --amend
command).
So, when you push it again to the server, he don’t understand what you want to do, hence the error.
You can oversteep this error with: git push -f your_origin your_branch
. It’s not recommended but it’s possible.
1
solved Error when pushing amended commit to remote [duplicate]