gpt4 book ai didi

git - 按特定扩展名从历史记录中删除文件

转载 作者:太空狗 更新时间:2023-10-29 14:37:49 24 4
gpt4 key购买 nike

我不小心提交了不应该在存储库中的文件。现在我想从历史记录中删除这些文件。它们的共同点是,它们的文件扩展名为 *.test。

我尝试应用索引过滤器,但它需要一个特定的文件名。

git filter-branch --force --index-filter 'git rm --chached --ignore-unmatch -r *.test' --prune-empty -- --all

是否可以在不手动指定的情况下一步对所有文件执行此操作?

最佳答案

这几乎令人难以置信,但我的脚本中有错字,但我想我也必须避开星号。

所以这个脚本对我有用

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch -r\*.test' --prune-empty -- --all

关于git - 按特定扩展名从历史记录中删除文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30560438/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com