Background to the issue
Git仓库常包含二进制/日志/临时文件等无用数据,手动筛选费时且易遗漏。
多层过滤方案
- 基础过滤:自动应用.gitignore规则(如node_modules/)
- 扩展过滤:通过文件类型检测排除二进制/媒体文件
- 大小过滤:默认跳过过大文件(可调整阈值)
- 历史加权:根据Git提交频率智能评估文件重要性
concrete operation
- 确保仓库有完整.gitignore文件
- 运行基础检查:yek –dry-run查看将被处理的文件列表
- 添加自定义规则:
– 在yek.toml中配置额外忽略模式
– 使用–include/–exclude参数临时调整 - 验证效果:对比处理前后的文件统计信息
typical case
处理前端项目时可自动忽略:
– build/ dist/等构建目录
– *.png等资源文件
– package-lock.json等依赖文件
专注于核心业务代码文件。
This answer comes from the articleYek: reading git repository text files and quickly chunking them for use in large modelsThe