在使用git的时候, 我用git commit --amend 命令修改了上一个提交的一些内容, 而上一个提交的内容已经被我用push推到远程服务器了, 现在我用git push -u origin master 推送 amend之后的提交, 推送失败了, 并给出了错误提示如下:
To https://github.com/Tate-zwt/WTMicroblog.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/Tate-zwt/WTMicroblog.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
上网搜了一下, 在stackoverflow上找到了解决办法, 是用 -f 参数 来push: git push -f origin master