从所有提交中删除文件 [英] Remove File from all Commits

查看:117
本文介绍了从所有提交中删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我上传了一个字体文件,我无权在几次更新之前将其分发给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会检查每个提交进入工作目录,运行命令
并重新提交。



- all:
过滤所有提交在所有分支机构中。



注意:请检查文件的路径,因为我不确定文件路径

希望这对你有所帮助!!!

I have uploaded a font file that I don't have the rights to distribute to git hub several updates ago. 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?

解决方案

In that case you could to use Git Filter Branch command with --tree-filter option.

syntax is git filter-branch --tree-filter <command> ...

git filter-branch --tree-filter 'rm -f Resources\Video\%font%.ttf' -- --all


Explanation about the command:

< command >: Specify any shell command.

--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

Hope this help you !!!

这篇关于从所有提交中删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆