当我使用下面命令的时候git
git add file git commit git push
这时候若是在push以前对刚才的commit作了任何修改(with git commit --amend
), spa
那么你将会获得以下错误code
hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
一般状况下,是不该该去修改一个already-pushed commit,但若是你真的遇到这个错误,那么能够使用 push -f ,覆盖remote commit.orm