Why i can't use comand "git commit --amend" and push that to github

415 views Asked by At

firstly I cloned my own repo from github, because i wanna amend the last commit, so i type "git commit --amend" and push to github, but some errors occur. Some guys said that the operation doesn't allowed by github, unless make another commit, Is that true? and how can i amend the last commit on github?

1

There are 1 answers

0
Max Woolf On BEST ANSWER

You totally can do this. However --amend rewrites history so you have to force the push to github. After using --amend just use

git push origin {branch_name} --force

Use with caution. This will overwrite history on the remote.