从git存储库中完全删除文件及其历史记录
我已经上传了一个字体文件,该字体文件几次更新之前都没有分发到git hub的权限。
I have uploaded a font file that I don't have the rights to distribute to git hub several updates ago.
我的存储库相对不活跃,我可以通知如有必要,我所有的成员。我已经尝试了几种解决方案。我需要删除目录中的文件 Resources\Video\%font%.ttf
,其中%font%
是该字体的普通,斜体和粗体版本的名称。我应该使用什么命令?
I have a relatively inactive repository and I have the ability to notify all of my members if necessary. I've tried several of the solutions. I need to delete a file in my directory called Resources\Video\%font%.ttf
where %font%
is the name of the plain, italicized and bold versions of the font. What commands do I use?
在这种情况下,您可以使用 Git过滤器分支命令,带有-tree-filter
选项。
In that case you could to use Git Filter Branch command with --tree-filter
option.
语法是 git filter-branch --tree-filter< command> ...
git filter-branch --tree-filter 'rm -f Resources\Video\%font%.ttf' -- --all
有关命令的说明:
<命令>:指定任何shell命令。
< command >: Specify any shell command.
-tree-filter:
Git将检查每个提交进入工作目录,运行命令
并重新提交。
--tree-filter: Git will check each commit out into working directory, run your command, and re-commit.
-全部:
过滤所有提交在所有分支中。
--all: Filter all commits in all branches.
注意:请检查文件路径,因为我不确定文件路径
Note: Kindly check the path for your file as I'm not sure for the file path
希望这对您有帮助!