如何永久删除存储在GIT中的文件? [英] How to permanently delete a file stored in GIT?
问题描述
我将数据库备份到GIT中,以便我可以在家用计算机上获取数据库。
I backed up my database to GIT just so I could get the db at my home computer.
我不希望此文件被版本化,它是只是一件事真的。
I don't want this file to be versioned, it was just a 1 time thing really.
我可以删除它,所以GIT不会跟踪它前进或历史?
Can I delete it for good so GIT doesn't keep track of it going forward or historically?
推荐答案
我总是发现指南:完全删除所有修订订阅源中的文件很有帮助。
要删除名为
Rakefile
:
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch Rakefile' \
--prune-empty --tag-name-filter cat -- --all
该命令将运行每个分支和标记的整个历史记录,更改涉及文件 > Rakefile ,以及之后的任何提交。提交之后为空的
(因为它们只改变了Rakefile)完全被删除了
。
This command will run the entire history of every branch and tag, changing any commit
that involved the file Rakefile
, and any commits afterwards. Commits
that are empty afterwards (because they only changed the Rakefile) are
removed entirely.
这篇关于如何永久删除存储在GIT中的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!