Git 不从其他存储库获取更新而推送到分支
我将工作推给我的主分支,但我得到了以下错误:Git 不从其他存储库获取更新而推送到分支,git,github,Git,Github,我将工作推给我的主分支,但我得到了以下错误: ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/Machinas/esprit-rwd' hint: Updates were rejected because the remote contains work that you do hint: not have locally.
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/Machinas/esprit-rwd'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushin
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.
我不想获取另一个人提交的更新,因为这是他们的一个错误,我怎么能推送并忽略该提交?谢谢如果您确实确定其他提交不相关,您可以执行强制推送:
git push --force-with-lease <remote> <branch>
git push——使用租约强制
警告:如果其他人已经做出错误的承诺,你会让他们不高兴。而做出错误承诺的人,最好得到你回购协议的新克隆
编辑:将--force
更改为--force with lease
,因为后者危险性较小。这就解释了原因。可能重复的