我做了一些糟糕的提交到github上托管的项目。我使用github的bfg工具删除了提交,然后推送给github,git克隆了我使用的各种本地机器上的项目。我的本地机器和github之间都是正常的。Git推 - 强制让远程主人丢弃错误的提交?
但是,我部署到仍包含错误提交的远程。当我这样做:
git push remote master
我得到这个错误:
! [rejected] master -> master (fetch first)
error: failed to push some refs to '[email protected]:blah/blah.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.
当我这样做:
git push --force remote master
一切收益作为预期;不过,我必须每次都这样做。有没有办法告诉git覆盖远程的主机,以便它在不克隆的情况下丢弃错误提交?
你试图做错误的建议和运行'git拉.. .'?这个错误意味着你在本地没有新的东西。 –
问题是,远程端的“新”提交是不好的,需要丢弃。我不希望他们合并。 –