从git历史中删除文件不起作用 [英] removing file from git history doesn't work
本文介绍了从git历史中删除文件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图使用此GitHub程序
I'm trying to remove a file which has sensitive data using this GitHub procedure.
然而,这并不适用于我的特定回购。当我运行时:
However, this doesn't work for my specific repo. When I run:
git filter-branch --index-filter 'git rm --cached --ignore-unmatch some_file.json' \
--prune-empty --tag-name-filter cat -- --all
完成后:
It completes with:
Rewrite 73f9cce9ab282cec272022314f361c1cd48955a7 (418/418)
WARNING: Ref 'refs/heads/master' is unchanged
WARNING: Ref 'refs/remotes/origin/blah' is unchanged
WARNING: Ref 'refs/remotes/origin/blah2' is unchanged
WARNING: Ref 'refs/remotes/origin/blah3' is unchanged
WARNING: Ref 'refs/remotes/origin/blah4' is unchanged
WARNING: Ref 'refs/remotes/origin/master' is unchanged
但没有任何变化。当我做的时候
But nothing has changed. When I do
git push origin master --force
它表示
一切都是最新的
Everything up-to-date
有人知道我在做什么错吗?
Does anyone know what I'm doing wrong?
推荐答案
根据评论中的讨论,使用文件的完整路径。当前版本的命令是在顶级repo目录中删除 some_file.json
。
Per discussion in comments, use the complete path of the file. The current version of the command is excising some_file.json
in the top level repo directory.
这篇关于从git历史中删除文件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文