當我使用下面命令的時候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