我做了一件不好的事情。
在进行一系列更改的过程中,我意识到一个意外的文件已经悄悄地出现在了一两个提交中。因为我直到后来才意识到这一点,所以包含该文件的提交现在已经被推送到了远程。我需要这些提交,但是我只想从中删除这个特定的文件。
当然,我需要做的是深入我的树的每一个角落(本地和远程),并消除那个文件。我尝试了使用 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.
push -f
命令可以解决这个问题。 - max