linux 递归删除.git,从git repo和提交历史中递归删除所有二进制文件

我已经阅读了关于从git commit history中删除大型二进制文件的

few

different

threads,但我的问题有点不同.因此,我的问题是要理解并确认步骤 –

我的git repo是〜/ foo.我想从repo中的一个目录中删除所有* .jpg,* .png,* .mp4,* .ogv(等等),特别是〜/ foo / public / data.

步骤1.删除文件

~/foo/data > find -E . -regex ".*\.(jpg|png|mp4|m4v|ogv|webm)" \

-exec git filter-branch --force --index-filter \

'git rm --cached --ignore-unmatch {}' \

--prune-empty --tag-name-filter cat -- --all \;

步骤2.将二进制文件扩展名添加到.gitignore并提交.gitignore

~/foo/data > cd ..

~/foo > git add .gitignore

~/foo > git commit -m "added binary files to .gitignore"

第3步.推动一切

~/foo > git push origin master --force

我在正确的轨道上面吗?我想在切一次之前测量两次,所以说.

更新:嗯,上面给了我错误

You need to run this command from the toplevel of the working tree.

You need to run this command from the toplevel of the working tree.

..

所以我把树上升到顶层并重新运行命令,这一切都奏效了.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值