2015-07-10 57 views
2

获取更新我去推动工作,我的主分支,但我得到这个错误:推分支,不受其他仓库

! [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. 

我不想获取更新另一个人COMMITED,因为它是一个他们的错误,我怎么能推动并忽略那个提交?由于

+0

[Force“git push”覆盖远程文件的可能的重复](http://stackoverflow.com/questions/10510462/force-git-push-to-overwrite-remote-files) –

回答

8

如果你真的真的确定,其他的提交是不相关的,你可以做一个力推

git push --force-with-lease <remote> <branch> 

警告:如果其他人已经拉错犯,你会做他们不高兴。而做出错误承诺的人应该更好地获得您的回购的新克隆。

编辑:改为--force--force-with-lease,因为后者危险性稍差。这Atlassian blog post解释了原因。