所以我做了件坏事。
在进行一系列更改过程中的某个地方,我意识到一个意外的文件已经溜进了一两个提交中。因为我直到后来才意识到这一点,所以包含文件的提交现在已经被推送到远程。我想要&需要提交,我只想从它们中删除这个特定的文件。
当然,我需要做的是深入到树的每个角落(本地和远程),并删除该文件。我尝试过一些使用filter-branch和filter-tree的方法,但是当我试图推动更改时,就会被拒绝。
我有什么选择?我做错了什么?
谢谢。
更新
在max的请求下,以下是我尝试推送时得到的信息:
$ git push origin develop
To git@codaset.com:robwilkerson/cakephp-polyclip-plugin.git
! [rejected] develop -> develop (non-fast-forward)
error: failed to push some refs to 'git@codaset.com:robwilkerson/cakephp-polyclip-plugin.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about fast-forwards' section of 'git push --help' for details.发布于 2010-10-31 23:31:47
你把-f (力)添加到git推送中了吗?没有那个标志,你就不能覆盖“旧”提交。
-f, --force
Usually, the command refuses to update a remote ref that is not an
ancestor of the local ref used to overwrite it. This flag disables
the check. This can cause the remote repository to lose commits;
use it with care.如果其他人已经从这些存储库中提取出来,它可能会变得很混乱。
发布于 2010-10-31 23:30:14
a nice guide在GitHub,这可能对你有帮助。
发布于 2010-10-31 23:36:10
您可以将修复实现为“新修复”,例如,立即删除文件,并将修复提交到存储库。
然后,当每个分支与您所做更改的版本同步时,应该将其传播到每个分支。
https://stackoverflow.com/questions/4065720
复制相似问题