我的目标是删除 github 上所有提交中的一个文件,因此我执行了后续步骤:
我用这个命令过滤了我的分支:
git filter-branch --index-filter 'git rm --cached --ignore-unmatch [file_name]' HEAD
在所有提交中删除一个文件,现在在运行后删除一个文件
git status
它要求我拉,
ubuntu@ubuntu:/var/www/html/laravel/app_folder$ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 18 and 18 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working directory clean
但我不想拉。我担心如果我拉出,我的提交中会再次出现这个文件。
我现在不应该推送它以便更改在我的 github 上生效吗……我不知道该怎么办。
当然,github 上的 git 和本地计算机上的 git 有不同的历史记录:一个有文件,一个没有。
你需要 :
git push --force
覆盖 github 存储库。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)