[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-f--git-rewrite-commits":3,"tool-f--git-rewrite-commits":64},[4,17,27,35,44,52],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",150720,2,"2026-04-11T11:33:10",[13,14,15],"开发框架","Agent","语言模型","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":10,"last_commit_at":23,"category_tags":24,"status":16},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[25,14,26,13],"插件","图像",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":10,"last_commit_at":33,"category_tags":34,"status":16},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[25,13],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":41,"last_commit_at":42,"category_tags":43,"status":16},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,3,"2026-04-06T11:19:32",[15,26,14,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":10,"last_commit_at":50,"category_tags":51,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,15],{"id":53,"name":54,"github_repo":55,"description_zh":56,"stars":57,"difficulty_score":10,"last_commit_at":58,"category_tags":59,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",85092,"2026-04-10T11:13:16",[26,60,61,25,14,62,15,13,63],"数据工具","视频","其他","音频",{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":78,"owner_company":79,"owner_location":80,"owner_email":81,"owner_twitter":82,"owner_website":83,"owner_url":84,"languages":85,"stars":102,"forks":103,"last_commit_at":104,"license":105,"difficulty_score":10,"env_os":106,"env_gpu":107,"env_ram":108,"env_deps":109,"category_tags":116,"github_topics":117,"view_count":10,"oss_zip_url":119,"oss_zip_packed_at":119,"status":16,"created_at":120,"updated_at":121,"faqs":122,"releases":158},6645,"f\u002Fgit-rewrite-commits","git-rewrite-commits","AI-powered git commit message rewriter using Ollama or GPT","git-rewrite-commits 是一款利用人工智能自动优化 Git 提交历史的开发者工具。它旨在解决项目早期开发中常见的提交信息混乱、不规范问题，能够一键将随意的提交描述重写为符合“约定式提交”（Conventional Commits）标准的专业格式，非常适合在开源项目发布前或功能分支合并前清理历史记录。\n\n该工具主要面向软件工程师和技术团队，特别是那些希望提升代码仓库可维护性但无暇手动修正大量历史提交的开发者。其核心技术亮点在于灵活的 AI 后端支持：既可通过 OpenAI GPT 实现高精度重写，也能连接本地 Ollama 模型，确保敏感代码差分数据完全在本地处理，无需上传至云端，从而兼顾了智能化与数据隐私安全。\n\n此外，git-rewrite-commits 内置了多重安全机制，包括操作前自动创建备份分支、敏感信息（如密钥）自动脱敏以及干跑模式预览，极大降低了重写历史的风险。它还支持多语言生成、自定义提示词和项目特定规范文件，让团队能灵活定制提交风格。无论是个人项目的整理，还是团队协作中的规范化治理，它都能高效地让杂乱的提交历史变得清晰有序。","# $ npx git-rewrite-commits\n\n> AI-powered git commit message rewriter using AI\n\n![](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ff_git-rewrite-commits_readme_fd1ef428c71d.png)\n\n[![npm version](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Fgit-rewrite-commits.svg)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fgit-rewrite-commits)\n[![Documentation](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fdocs-live-blue)](https:\u002F\u002Ff.github.io\u002Fgit-rewrite-commits\u002F)\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg)](https:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT)\n[![Blog Post](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fblog-read-orange)](https:\u002F\u002Fblog.fka.dev\u002Fblog\u002F2025-11-16-git-rewrite-commits-fix-your-messy-commit-history-with-ai\u002F)\n\nAutomatically rewrite your entire git commit history with better, conventional commit messages using AI. Perfect for cleaning up messy commit histories before open-sourcing projects or improving repository maintainability.\n\n📖 **[Read the blog post: Fix Your Messy Commit History with AI](https:\u002F\u002Fblog.fka.dev\u002Fblog\u002F2025-11-16-git-rewrite-commits-fix-your-messy-commit-history-with-ai\u002F)**\n\n## Important Disclaimer\n\n> **This tool rewrites git history, which is generally NOT recommended for shared repositories!**\n> \n> **When to use:**\n> - Personal projects before making them public\n> - Feature branches before merging (with team agreement)\n> - Cleaning up local commits before pushing\n> - Preparing repositories for open-sourcing\n> \n> **When NOT to use:**\n> - On shared branches without team coordination\n> - After pushing commits that others have pulled\n> - On main\u002Fmaster branches of team projects\n> - In repositories where commit hashes are referenced\n> \n> **Remember:** Rewriting history changes commit hashes and requires force-pushing, which can disrupt your team's workflow.\n\n## Security & Privacy\n\n🔒 **Important Privacy Notice**: When using remote AI providers (OpenAI), this tool sends your file lists and diffs to external APIs. \n\n**Security Features:**\n- ✅ **Explicit consent required** before sending data to remote providers\n- ✅ **Automatic redaction** of API keys, passwords, and private keys\n- ✅ **Local processing option** via Ollama (no data leaves your machine)\n- ✅ **Opt-in hooks** - all hooks require explicit enabling via git config\n- ✅ **Secure argument handling** - prevents shell injection attacks\n- ✅ **Always creates backups** before history rewrites\n\n**Recommended for sensitive repositories:**\n```bash\n# Use local Ollama instead of remote APIs\ngit config hooks.commitProvider ollama\ngit config hooks.providerModel gemma3\n\nollama pull gemma3\nollama serve\n```\n\n> 📖 See [SECURITY.md](SECURITY.md) for complete security documentation\n\n## Features\n- **AI-powered commit message generation** using OpenAI GPT or local Ollama models\n- **Rewrite entire git history** with better commit messages\n- **Conventional commits** format (feat, fix, chore, etc.)\n- **Multi-language support** - generate commits in any language\n- **Smart filtering** - skip already well-formed commits\n- **Local AI option** with Ollama - no data leaves your machine\n- **Git hooks integration** - automatic AI messages on every commit\n- **Intelligent analysis** of code changes to generate meaningful messages\n- **Batch processing** with rate limiting\n- **Safe operation** with automatic backup branches\n- **Custom templates** for team-specific formats\n- **Quality scoring** to identify commits that need improvement\n- **Verbose mode** with diff preview and detailed processing information\n- **Custom prompts** - Override AI behavior with `--prompt` for unique styles\n- **Efficient processing** - Process only the last N commits with `--max-commits`\n- **Dry-run mode** - Preview changes before applying them\n- **Progress tracking** - Real-time progress indicators with colored output\n- **Custom context** - Project-specific guidelines via `COMMIT_MESSAGE.md` file\n\n## Installation\n\n### Quick Start (No Installation Required)\n```bash\nnpx git-rewrite-commits\n# or shorter:\nnpx grec\n```\n\n#### Very Quick Example\n\nSet `OPENAI_API_KEY` as environment variable. And:\n\n```bash\ngit add -A\ngit commit -m \"$(npx -y grec --quiet --staged --skip-remote-consent)\"\n\n> [main 9979e7e] feat(specs): update subscription status handling in webhook controller\n3 files changed, 432 insertions(+), 9 deletions(-)\ncreate mode 100644 spec\u002Fcontrollers\u002Fwebhooks_spec.rb\n\ngit push origin master\n```\n\n### Global Installation\n```bash\n# Full command name\nnpm install -g git-rewrite-commits\n\n# Or install the short alias (grec = git-rewrite-commits)\nnpm install -g grec\n\n# Both work identically:\ngit-rewrite-commits --help\ngrec --help  # Same thing, just shorter!\n```\n\n> ✅ **Works on all platforms**: Windows, macOS, Linux  \n> 💡 **Tip**: `grec` is a shorter alias for `git-rewrite-commits` - use whichever you prefer!\n\n## Quick Hook Installation\n\n**Step 1: Install or update the AI commit message hooks**\n\n```bash\nnpx git-rewrite-commits --install-hooks\n# or with the short alias:\nnpx grec --install-hooks\n```\n\n> 💡 **Updates existing hooks**: If hooks already exist, they'll be updated to the latest version. Non-git-rewrite-commits hooks are backed up before replacement.\n\n**Step 2: Enable the hooks you want (opt-in required for security):**\n\n```bash\n# Option A: Enable message preview before commit\ngit config hooks.preCommitPreview true\n\n# Option B: Enable automatic message generation\ngit config hooks.prepareCommitMsg true\n\n# Or enable both for the full experience!\n\n# For privacy: use local Ollama instead of remote OpenAI\ngit config hooks.commitProvider ollama\ngit config hooks.providerModel llama3.2  # Optional: specify model\n```\n\n**Step 3: Configure your AI provider:**\n\n```bash\n# Option A: OpenAI (sends data to remote API)\nexport OPENAI_API_KEY=\"your-api-key\"  # Unix\u002FmacOS\n# set OPENAI_API_KEY=\"your-api-key\"    # Windows\n\n# Option B: Ollama (local processing, recommended for sensitive repos)\nollama pull llama3.2\nollama serve\n\n# Option C: Ollama on a custom server\u002Fport\nexport OLLAMA_URL=\"http:\u002F\u002F192.168.1.100:11434\"  # Unix\u002FmacOS\n# set OLLAMA_URL=http:\u002F\u002F192.168.1.100:11434     # Windows\n```\n\n> **See [QUICK_START.md](QUICK_START.md) for detailed setup guide**\n\n### Additional Configuration (Optional)\n\n```bash\n# Set your template format\ngit config hooks.commitTemplate \"[JIRA-XXX] feat: message\"\n\n# Set language\ngit config hooks.commitLanguage \"es\"  # Spanish, French, etc.\n\n# Set specific model\ngit config hooks.providerModel \"gpt-4\"  # or \"gpt-3.5-turbo\", \"llama3.2\", etc.\n\n# Set custom Ollama server URL (if not using localhost:11434)\ngit config hooks.ollamaUrl \"http:\u002F\u002F192.168.1.100:11434\"\n```\n\n### Custom Project Guidelines with `COMMIT_MESSAGE.md`\n\nYou can provide project-specific commit message guidelines that the AI will follow by creating a `COMMIT_MESSAGE.md` file. The tool searches for this file in the following locations (in order):\n\n1. **Project root** - `.\u002FCOMMIT_MESSAGE.md`\n2. **Git directory** - `.\u002F.git\u002FCOMMIT_MESSAGE.md`\n3. **GitHub directory** - `.\u002F.github\u002FCOMMIT_MESSAGE.md`\n\nExample `COMMIT_MESSAGE.md`:\n```markdown\n# Project Commit Guidelines\n\n## Requirements\n- Use conventional commits with these scopes: auth, api, ui, db\n- Include ticket numbers when available (e.g., JIRA-123)\n- Security changes must be clearly marked\n- Breaking changes need BREAKING CHANGE in the message\n\n## Project Context\nThis is a financial services API that handles sensitive data.\nEmphasize security, compliance, and performance in commit messages.\n```\n\nSee [`COMMIT_MESSAGE.md.example`](COMMIT_MESSAGE.md.example) in this repository for a complete example.\n\n## Usage\n\n### Command Examples\n\n```bash\n# Using the full command name\nnpx git-rewrite-commits [options]\n\n# Or using the short alias (grec)\nnpx grec [options]\n```\n\nCommon use cases:\n\n```bash\n# Rewrite entire git history\nnpx git-rewrite-commits\n\n# Preview changes without applying (dry run)\nnpx git-rewrite-commits --dry-run\n\n# Generate commit message for staged changes\nnpx git-rewrite-commits --staged\n\n# Process only last 10 commits\nnpx git-rewrite-commits --max-commits 10\n\n# Use custom AI model\nnpx git-rewrite-commits --model gpt-4\n\n# Use local AI with Ollama\nnpx git-rewrite-commits --provider ollama\n\n# Install\u002Fupdate git hooks\nnpx git-rewrite-commits --install-hooks\n```\n\n## Real-World Examples\n\n### Automatic Commit Message Generation\n\n**Two Smart Hooks**: \n1. **pre-commit**: Preview AI message and optionally replace bad commit messages\n2. **prepare-commit-msg**: Automatically generate or use approved messages\n\n```bash\n# Install the hooks (using either command)\nnpx git-rewrite-commits --install-hooks\n# or\nnpx grec --install-hooks\n\n# Enable them (opt-in for security)\ngit config hooks.preCommitPreview true    # Preview before commit\ngit config hooks.prepareCommitMsg true    # Auto-generate in editor\n\n# Configure provider\ngit config hooks.commitProvider ollama  # or use OpenAI with OPENAI_API_KEY\ngit config hooks.providerModel llama3.2  # Optional: specify model\n```\n\nNow when you run `git commit`:\n- With pre-commit: You'll see a preview of the AI message first\n- With prepare-commit-msg: The AI message appears in your editor\n\n### Manual Rewriting for Existing Commits\n\n```bash\n# Clean up the last 5 commits before pushing\necho \"🔧 Improving commit messages before push...\"\nnpx git-rewrite-commits --max-commits 5 --dry-run\n\necho \"Apply changes? (y\u002Fn)\"\nread answer\nif [ \"$answer\" = \"y\" ]; then\n```\n\n### Alias for Quick Fixes\n\nAdd to your `~\u002F.gitconfig` or `~\u002F.zshrc`\u002F`~\u002F.bashrc`:\n\n```bash\n# Git alias\ngit config --global alias.fix-commits '!npx git-rewrite-commits --max-commits'\n\n# Usage: git fix-commits 3\n```\n\n```bash\n# Shell alias\nalias fix-last-commit='npx git-rewrite-commits --max-commits 1 --skip-backup'\nalias fix-branch='npx git-rewrite-commits --max-commits 20'\n\n# Usage: fix-last-commit\n```\n\n### Team Workflow: Feature Branch Cleanup\n\nBefore creating a pull request:\n\n```bash\n# 1. Check what needs fixing\nnpx git-rewrite-commits --dry-run --max-commits 10\n\n# 2. Apply improvements\nnpx git-rewrite-commits --max-commits 10\n\n# 3. Force push to your feature branch\ngit push --force-with-lease origin feature-branch\n```\n\n### CI\u002FCD Integration\n\nAdd to your CI pipeline (e.g., GitHub Actions) for PR validation:\n\n```yaml\n- name: Check Commit Quality\n  run: |\n    npx git-rewrite-commits --dry-run --max-commits ${{ github.event.pull_request.commits }}\n    # This will show which commits would be improved\n```\n\n### Preparing for Open Source\n\nBefore making a private repo public:\n\n```bash\n# Fix all commits with custom template\nnpx git-rewrite-commits \\\n  --template \"feat(scope): message\" \\\n  --language en \\\n  --no-skip-well-formed\n\n# Review the changes\ngit log --oneline -20\n\n# If satisfied, force push\ngit push --force-with-lease origin main\n```\n\n## How It Works\n\n1. **Analyze**: Reads your staged changes or commit history\n2. **Generate**: Uses AI to create meaningful, conventional commit messages\n3. **Apply**: Updates your commits with better messages\n\n### Smart Message Replacement\nWhen you use `git commit -m \"bad message\"`, pre-commit can:\n- Suggest a better AI-generated message\n- **Replace your bad message** when you approve it\n- Show what was replaced in the commit editor\n\n### History Rewriting Process\n1. **Creates backup**: Saves current branch state\n2. **Rewrites history**: Uses `git filter-branch` to apply new messages\n3. **Provides recovery**: Keeps backup branch for restoration if needed\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature\u002FAmazingFeature`)\n3. Commit your changes (using conventional commits!)\n4. Push to the branch (`git push origin feature\u002FAmazingFeature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Bug Reports\n\nIf you discover any bugs, please create an issue [here](https:\u002F\u002Fgithub.com\u002Ff\u002Fgit-rewrite-commits\u002Fissues).\n\n## Contact\n\nFor questions and support, please open an issue in the GitHub repository.\n\n---\n\n**Remember: Always backup your repository before rewriting history!** 🔒\n","# 项目提交指南\n\n请确保每次提交都包含以下信息：\n\n1. **类型**: 使用符合 Conventional Commits 格式的前缀，例如 `feat:`、`fix:`、`docs:` 等。\n2. **描述**: 简洁明了地说明本次提交的目的和内容。\n3. **关联问题**: 如果提交与特定问题相关，请在提交信息中提及问题编号或链接。\n\n示例：\n```\nfeat: 添加用户注册功能\nfix: 修复登录页面的样式问题\ndocs: 更新 README 文件中的使用说明\n```\n\n请注意：所有提交必须遵循上述格式，以保持代码库的一致性和可维护性。\n\n## 需求\n- 使用带有以下作用域的规范提交：auth、api、ui、db\n- 如果有工单号，请一并注明（例如：JIRA-123）\n- 安全相关变更必须明确标注\n- 破坏性变更需要在消息中包含 BREAKING CHANGE\n\n## 项目背景\n这是一个处理敏感数据的金融服务API。\n请在提交信息中强调安全性、合规性和性能。\n\n```\n请参阅本仓库中的 [`COMMIT_MESSAGE.md.example`](COMMIT_MESSAGE.md.example)，以获取完整示例。\n```\n\n## 使用方法\n\n### 命令示例\n\n```bash\n# 使用完整命令名\nnpx git-rewrite-commits [options]\n\n# 或使用简短别名 (grec)\nnpx grec [options]\n```\n\n常见用法：\n\n```bash\n# 重写整个 Git 历史\nnpx git-rewrite-commits\n\n# 预览更改而不应用（试运行）\nnpx git-rewrite-commits --dry-run\n\n# 为暂存的更改生成提交信息\nnpx git-rewrite-commits --staged\n\n# 仅处理最近 10 条提交\nnpx git-rewrite-commits --max-commits 10\n\n# 使用自定义 AI 模型\nnpx git-rewrite-commits --model gpt-4\n\n# 使用 Ollama 的本地 AI\nnpx git-rewrite-commits --provider ollama\n\n# 安装或更新 Git 钩子\nnpx git-rewrite-commits --install-hooks\n```\n\n## 实际案例\n\n### 自动化提交信息生成\n\n**两个智能钩子**：\n1. **pre-commit**：预览 AI 生成的信息，并可选择替换不良提交信息\n2. **prepare-commit-msg**：自动生成功能或使用已批准的信息\n\n```bash\n# 安装钩子（任选其一）\nnpx git-rewrite-commits --install-hooks\n# 或\nnpx grec --install-hooks\n\n# 启用它们（出于安全考虑需手动开启）\ngit config hooks.preCommitPreview true    # 提交前预览\ngit config hooks.prepareCommitMsg true    # 编辑器中自动生成\n\n# 配置提供商\ngit config hooks.commitProvider ollama  # 或使用 OpenAI 并设置 OPENAI_API_KEY\ngit config hooks.providerModel llama3.2  # 可选：指定模型\n```\n\n现在当你执行 `git commit` 时：\n- 使用 pre-commit 钩子：你会先看到 AI 生成的信息预览\n- 使用 prepare-commit-msg 钩子：AI 生成的信息会出现在编辑器中\n\n### 手动重写现有提交\n\n```bash\n# 在推送前清理最近 5 条提交\necho \"🔧 正在优化提交信息以便推送...\"\nnpx git-rewrite-commits --max-commits 5 --dry-run\n\necho \"是否应用更改？(y\u002Fn)\"\nread answer\nif [ \"$answer\" = \"y\" ]; then\n```\n\n### 快速修复的别名\n\n添加到你的 `~\u002F.gitconfig` 或 `~\u002F.zshrc`\u002F`~\u002F.bashrc` 文件中：\n\n```bash\n# Git 别名\ngit config --global alias.fix-commits '!npx git-rewrite-commits --max-commits'\n\n# 使用方法：git fix-commits 3\n```\n\n```bash\n# Shell 别名\nalias fix-last-commit='npx git-rewrite-commits --max-commits 1 --skip-backup'\nalias fix-branch='npx git-rewrite-commits --max-commits 20'\n\n# 使用方法：fix-last-commit\n```\n\n### 团队工作流程：特性分支清理\n\n在创建拉取请求之前：\n\n```bash\n# 1. 检查需要修复的内容\nnpx git-rewrite-commits --dry-run --max-commits 10\n\n# 2. 应用改进\nnpx git-rewrite-commits --max-commits 10\n\n# 3. 强制推送到你的特性分支\ngit push --force-with-lease origin feature-branch\n```\n\n### CI\u002FCD 集成\n\n将以下内容添加到你的 CI 流水线（例如 GitHub Actions）中，用于验证拉取请求：\n\n```yaml\n- name: 检查提交质量\n  run: |\n    npx git-rewrite-commits --dry-run --max-commits ${{ github.event.pull_request.commits }}\n    # 这将显示哪些提交可以被改进\n```\n\n### 准备开源\n\n在将私有仓库公开之前：\n\n```bash\n# 使用自定义模板修复所有提交\nnpx git-rewrite-commits \\\n  --template \"feat(scope): message\" \\\n  --language en \\\n  --no-skip-well-formed\n\n# 检查更改\ngit log --oneline -20\n\n# 如果满意，强制推送\ngit push --force-with-lease origin main\n```\n\n## 工作原理\n\n1. **分析**：读取你暂存的更改或提交历史\n2. **生成**：利用 AI 创建有意义的规范提交信息\n3. **应用**：用更好的信息更新你的提交\n\n### 智能信息替换\n当你使用 `git commit -m \"bad message\"` 时，pre-commit 钩子可以：\n- 推荐更好的 AI 生成信息\n- 在你批准后**替换掉原来的差劲信息**\n- 在提交编辑器中显示被替换的内容\n\n### 历史重写流程\n1. **创建备份**：保存当前分支状态\n2. **重写历史**：使用 `git filter-branch` 应用新信息\n3. **提供恢复功能**：保留备份分支，以备不时之需\n\n## 贡献\n欢迎贡献！请随时提交 Pull Request。对于重大更改，请先打开一个议题讨论你想要修改的内容。\n\n1. 分支仓库\n2. 创建你的特性分支 (`git checkout -b feature\u002FAmazingFeature`)\n3. 提交你的更改（使用规范提交！）\n4. 推送到分支 (`git push origin feature\u002FAmazingFeature`)\n5. 打开 Pull Request\n\n## 许可证\n本项目采用 MIT 许可证——详情请参阅 [LICENSE](LICENSE) 文件。\n\n## 错误报告\n如果你发现任何错误，请在此处提交问题：[https:\u002F\u002Fgithub.com\u002Ff\u002Fgit-rewrite-commits\u002Fissues](https:\u002F\u002Fgithub.com\u002Ff\u002Fgit-rewrite-commits\u002Fissues)\n\n## 联系方式\n如有疑问或需要支持，请在 GitHub 仓库中提交问题。\n\n---\n\n**请记住：在重写历史之前务必备份你的仓库！** 🔒","# git-rewrite-commits 快速上手指南\n\n`git-rewrite-commits` 是一款基于 AI 的 Git 提交信息重写工具，能够自动将混乱的提交历史优化为符合规范（Conventional Commits）的格式。非常适合在开源项目发布前或提升仓库可维护性时使用。\n\n> ⚠️ **重要警告**：此工具会**重写 Git 历史**（修改 Commit Hash）。\n> - ✅ **适用场景**：个人项目公开前、特性分支合并前、本地提交整理。\n> - ❌ **禁止场景**：多人协作的主分支、他人已拉取的共享分支。重写历史需要强制推送（force push），可能导致团队工作流中断。\n\n## 环境准备\n\n- **操作系统**：Windows, macOS, Linux\n- **前置依赖**：\n  - Node.js (推荐 v16+) 和 npm\n  - Git\n- **AI 提供商（二选一）**：\n  1. **OpenAI**（云端）：需准备 `OPENAI_API_KEY`。\n  2. **Ollama**（本地，推荐用于敏感代码）：需安装 [Ollama](https:\u002F\u002Follama.com) 并下载模型（如 `llama3.2` 或 `gemma3`）。\n\n## 安装步骤\n\n无需全局安装，推荐使用 `npx` 直接运行（按需加载）：\n\n```bash\n# 方式一：使用完整命令\nnpx git-rewrite-commits\n\n# 方式二：使用简短别名 (grec)\nnpx grec\n```\n\n若需全局安装以便随时调用：\n\n```bash\nnpm install -g git-rewrite-commits\n# 或安装简短别名\nnpm install -g grec\n```\n\n## 基本使用\n\n### 场景一：快速生成单次提交信息\n\n设置好环境变量后，可直接用于生成当前暂存区的提交信息：\n\n```bash\n# 1. 设置 OpenAI Key (Unix\u002FmacOS)\nexport OPENAI_API_KEY=\"your-api-key\"\n\n# 2. 执行提交（自动分析暂存区文件并生成规范消息）\ngit add -A\ngit commit -m \"$(npx -y grec --quiet --staged --skip-remote-consent)\"\n```\n\n*注：若使用本地 Ollama，请确保 `ollama serve` 已运行，并添加 `--provider ollama` 参数。*\n\n### 场景二：重写最近的提交历史\n\n清理最近 N 条提交记录，使其符合规范：\n\n```bash\n# 预览变更（不实际执行，安全检查）\nnpx grec --dry-run --max-commits 5\n\n# 确认无误后，执行重写（会自动创建备份分支）\nnpx grec --max-commits 5\n\n# 如果满意结果，推送到远程（注意：需要强制推送）\ngit push --force-with-lease origin \u003Cbranch-name>\n```\n\n### 场景三：配置本地 AI (保护隐私)\n\n对于包含敏感代码的项目，建议使用本地模型：\n\n```bash\n# 1. 拉取并运行本地模型\nollama pull llama3.2\nollama serve\n\n# 2. 配置工具使用 Ollama\ngit config hooks.commitProvider ollama\ngit config hooks.providerModel llama3.2\n\n# 3. 执行重写\nnpx grec --max-commits 10\n```\n\n### 进阶：自定义项目规范\n\n在项目根目录创建 `COMMIT_MESSAGE.md` 文件，AI 将遵循其中的约定（如 Scope 范围、JIRA 票号格式等）：\n\n```markdown\n# Project Commit Guidelines\n\n## Requirements\n- Scopes: auth, api, ui, db\n- Include ticket numbers (e.g., JIRA-123)\n- Language: Chinese\n```\n\n工具会自动读取该文件以生成更符合团队风格的提交信息。","某初创团队的核心工程师在将内部孵化半年的项目正式开源前，急需整理混乱的本地提交记录以符合社区规范。\n\n### 没有 git-rewrite-commits 时\n- 提交历史充斥着\"fix bug\"、\"update code\"、\"wip\"等随意描述，外部贡献者完全无法理解每次变更的具体意图。\n- 手动重写数十个历史提交不仅耗时数小时，还极易因操作失误导致分支错乱或代码丢失。\n- 由于缺乏统一格式，提交信息未遵循 Conventional Commits 规范，导致无法自动生成变更日志（Changelog）和版本号。\n- 担心敏感信息（如临时硬编码的密钥片段）随 diffs 被意外暴露给公共 AI 服务，不敢轻易使用自动化工具。\n- 在反复修改提交信息的过程中，难以保证上下文连贯性，经常出现描述与实际代码改动不符的情况。\n\n### 使用 git-rewrite-commits 后\n- 一键扫描整个历史，AI 自动将模糊描述重构为语义清晰的标准化信息（如 `feat: add user authentication`），大幅提升可读性。\n- 内置安全机制自动红敏敏感数据，并支持通过 Ollama 进行纯本地化处理，确保私有代码绝不流出机器。\n- 自动将所有提交转换为 Conventional Commits 格式，直接打通了后续自动化发布和生成精美 Changelog 的流程。\n- 提供 Dry-run 模式和自动备份分支，让工程师在确认预览效果无误后再执行重写，彻底消除“改坏历史”的焦虑。\n- 智能分析代码 Diff 上下文，生成的提交信息精准对应具体逻辑变更，甚至能识别出被遗漏的关键修复细节。\n\ngit-rewrite-commits 将原本需要半天的人工清洗工作压缩至几分钟，帮助开发者以专业、整洁的代码历史迎接开源社区的第一次审视。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ff_git-rewrite-commits_fd1ef428.png","f","Fatih Kadir Akın","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Ff_f3b6735b.jpg","Building prompts.chat — JavaScript Developer. Ruby Lover. Author. — @GitHub Star.","@Teknasyon ","Istanbul, Turkey","fka@fka.dev","fkadev","http:\u002F\u002Ffka.dev","https:\u002F\u002Fgithub.com\u002Ff",[86,90,94,98],{"name":87,"color":88,"percentage":89},"TypeScript","#3178c6",50.8,{"name":91,"color":92,"percentage":93},"JavaScript","#f1e05a",18.8,{"name":95,"color":96,"percentage":97},"Shell","#89e051",15.3,{"name":99,"color":100,"percentage":101},"Batchfile","#C1F12E",15.1,1409,56,"2026-04-11T00:45:55","MIT","Windows, macOS, Linux","非必需。若使用本地 AI 模型（Ollama），取决于所选模型的需求；若使用远程 API（OpenAI）则无需本地 GPU。","未说明",{"notes":110,"python":108,"dependencies":111},"该工具基于 Node.js (npx\u002Fnpm) 运行，而非 Python。核心功能依赖外部 AI 服务：既可使用远程 OpenAI API（需联网及 API Key），也可配置本地 Ollama 服务（需自行安装 Ollama 并下载模型如 llama3.2\u002Fgemma3）。重写 Git 历史前会自动创建备份分支。涉及敏感数据时建议使用本地 Ollama 模式以避免数据外传。",[112,113,114,115],"Node.js (运行 npx\u002Fnpm)","git","OpenAI API Key (可选)","Ollama (可选，用于本地推理)",[15,25],[113,118],"pre-commit-hook",null,"2026-03-27T02:49:30.150509","2026-04-11T23:22:27.336190",[123,128,133,138,143,148,153],{"id":124,"question_zh":125,"answer_zh":126,"source_url":127},29994,"如何在 macOS 或配置为 ES Module 的项目中解决 'require is not defined' 错误？","该问题通常发生在项目 package.json 中包含 \"type\": \"module\" 时，导致工具生成的临时脚本被误判为 ES 模块。维护者已在新版本中修复了此问题。请升级工具到最新版本（参考 Issue #15 的修复），如果问题仍然存在，请尝试更新到 v0.7.3 或更高版本进行测试。","https:\u002F\u002Fgithub.com\u002Ff\u002Fgit-rewrite-commits\u002Fissues\u002F2",{"id":129,"question_zh":130,"answer_zh":131,"source_url":132},29995,"在 Windows 上运行时出现 'fatal: invalid object name' 错误怎么办？","这是 Windows 路径处理导致的已知问题，表现为 'fatal: invalid object name 'C'' 等错误。维护者已发布新版本修复了该路径解析问题。请务必升级到最新版本。如果使用的是 WSL 或 Git Bash 仍遇到此问题，也请确认已更新至修复后的版本。","https:\u002F\u002Fgithub.com\u002Ff\u002Fgit-rewrite-commits\u002Fissues\u002F12",{"id":134,"question_zh":135,"answer_zh":136,"source_url":137},29996,"是否支持使用本地 LLM（如 Ollama）而不是 API Key？","是的，工具支持使用 Ollama 进行本地 AI 处理。你可以使用 '--provider ollama' 参数来启用它。例如：'npx git-rewrite-commits --dry-run --max-commits 10 --provider ollama'。请确保你的工具版本已包含此功能（v0.3.2 可能尚不支持，请升级到最新版），并且本地 Ollama 服务正在运行（ollama serve）。","https:\u002F\u002Fgithub.com\u002Ff\u002Fgit-rewrite-commits\u002Fissues\u002F1",{"id":139,"question_zh":140,"answer_zh":141,"source_url":142},29997,"为什么日志输出会污染生成的提交信息？","这是一个已修复的 Bug，特定版本的代码会将控制台日志（如 Ollama  provider 的提示信息）意外写入到提交消息中。该问题已在 v0.7.1 版本中修复。如果你发现生成的提交消息中包含无关的日志文本，请将工具升级到 v0.7.1 或更高版本。","https:\u002F\u002Fgithub.com\u002Ff\u002Fgit-rewrite-commits\u002Fissues\u002F18",{"id":144,"question_zh":145,"answer_zh":146,"source_url":147},29998,"运行时报错 'spawnSync \u002Fbin\u002Fsh ENOBUFS' 或 'git diff-tree' 失败如何解决？","这通常是由于缓冲区溢出或特定仓库状态引起的。建议首先尝试升级到最新版本，因为维护者经常在此类问题上发布热修复。如果问题依旧，可以尝试在一个全新的空白 Git 仓库中测试命令以排除环境干扰。如果仍然失败，可能需要提供更多调试信息给维护者。","https:\u002F\u002Fgithub.com\u002Ff\u002Fgit-rewrite-commits\u002Fissues\u002F10",{"id":149,"question_zh":150,"answer_zh":151,"source_url":152},29999,"工具重写了错误的提交或行为异常怎么办？","如果在执行后发现提交被错误重写（例如应用到了错误的 commit hash），这曾是一个严重问题。多个用户报告在 v0.7.3 版本中仍可能出现此类情况。建议立即从自动创建的备份分支恢复（例如 'git reset --hard backup-\u003Cbranch-name>-\u003Ctimestamp>'），并检查是否有更新的版本修复了此逻辑错误。在执行重写前，务必确保已备份仓库并在独立分支上操作。","https:\u002F\u002Fgithub.com\u002Ff\u002Fgit-rewrite-commits\u002Fissues\u002F13",{"id":154,"question_zh":155,"answer_zh":156,"source_url":157},30000,"如何针对不同项目自定义 AI 提示词（Prompts）？","虽然目前主要功能集中在重写提交信息，但社区已提出需要针对每个仓库自定义 System 和 User Prompt 的需求。理想的解决方案是允许在全局配置文件（如 ~\u002F.git-rewrite-commits.conf）中覆盖默认模板，并在项目根目录中提供局部覆盖文件。请关注后续版本更新以获取原生的配置文件支持，目前可能需要通过源码修改或等待该特性落地。","https:\u002F\u002Fgithub.com\u002Ff\u002Fgit-rewrite-commits\u002Fissues\u002F17",[]]