0

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?

Martin G
  • 17,357
  • 9
  • 82
  • 98
yzycqu
  • 35
  • 4

1 Answers1

4

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.

Max Woolf
  • 3,988
  • 1
  • 26
  • 39