我已经上传了一个字体文件,该文件我无权在数个更新之前分发到git hub。我的存储库相对不活跃,如果需要,我可以通知所有成员。我已经尝试了几种解决方案。我需要删除目录中的文件Resources\Video\%font%.ttf
,其中%font%
是该字体的普通,斜体和粗体版本的名称。我使用什么命令?
在那种情况下,您可以将Git Filter Branch命令与--tree-filter
选项一起使用。
语法是git filter-branch --tree-filter <command> ...
git filter-branch --tree-filter 'rm -f Resources\Video\%font%.ttf' -- --all
有关命令的说明:
:指定任何shell命令。
-tree-filter:Git将每次提交检入到工作目录中,运行命令,并重新提交。
----所有:过滤所有分支中的所有提交。
注意:请检查文件路径,因为我不确定文件路径
希望这对您有帮助!
[git filter-branch --index-filter 'git rm --cached --ignore-unmatch Resources\Video\%font%.ttf'
可以比--tree-filter
快很多(最高100倍),因为它仅更新git历史记录而不更新工作目录。
ref:What is the difference between "--tree-filter" and "--index-filter" in the "git filter-branch"?