
GCOP (Git Copilot) —— 你的 AI 驱动 Git 助手,将混乱的提交转变为有意义的故事。它自动生成提交信息,优化你的 Git 流程,并通过 20 多条智能命令让版本控制变得轻而易举。
🚀 核心功能
- 🤖 智能提交信息生成
- 使用 AI 分析更改并生成上下文完美的提交信息。
- 学习项目提交历史以匹配团队风格。
- 🎨 高度可定制化
- 创建适合项目需求的自定义提交模板。
- 使用自定义提示微调提交信息风格。
- 配置项目专属设置,保持团队一致性。
- 📚 智能学习功能
- 自动学习代码库提交历史。
- 随时间推移适应团队提交惯例。
- 通过持续学习提高信息质量。
- ⚡ 无缝开发体验
- 配备 20 多种直观的 Git 快捷命令。
- 智能别名让复杂的 Git 操作轻松完成。
- 与您喜欢的 AI 模型集成(如 OpenAI、Anthropic 等)。
- 零配置融入现有 Git 工作流。
视频演示
这个视频展示了如何使用 GCOP 生成提交信息,请查看 文档。
🛠️ 快速开始
我们建议您详细阅读 快速入门指南。
您需要准备
- Python 3.8 或更新版本
- 安装了 Git
- 一把用于首选 LLM(如 OpenAI、Anthropic)的 API 密钥
安装
- 使用 pip 安装 GCOP:
pip install gcop - 初始化 GCOP:
gcop init
该命令会设置 GCOP 并将其别名添加到您的 Git 配置中。
- 配置 AI 模型:
git gconfig
该命令会打开配置文件,编辑文件以包含您的 AI 提供商信息:model: model_name: provider/name, eg openai/gpt-4o api_key: your_api_key
随后 GCOP 会生成一个 config.yaml,并打开该文件供您设置语言模型。详细配置请参考 如何配置模型。
config.yaml存储路径:
- Windows:
%USERPROFILE%\.zeeland\gcop\config.yaml- Linux:
~/.zeeland/gcop/config.yaml- MacOS:
~/.zeeland/gcop/config.yaml
- 验证安装:
git ghelp
您应能看到如下输出:gcop is your local git command copilot Version: 1.0.0 GitHub: https://github.com/Undertone0809/gcop Usage: git [OPTIONS] COMMAND Commands: git p Push changes to remote repository git pf Force push changes to remote repository git undo Undo last commit, keep changes git ghelp Show this help message git gconfig Open config file in default editor git gcommit Generate AI commit message and commit changes git ac Add all changes and commit with AI message git c Shorthand for 'git gcommit'
💡 基本用法
生成 AI 提交信息
对项目进行更改后:
- 保存您的更改:
git add . - 生成并应用 AI 提交信息:
git c
输出示例:? Select a commit message to commit (Use arrow keys) » feat: Implement user authentication system docs: Update installation instructions in README fix: Resolve database connection timeout issue style: Improve code formatting in src/main.py retry - 使用方向键选择最合适的信息并按 Enter。
其他常用命令
git ac:添加所有更改并使用 AI 生成的信息提交。git ac
输出:Changes added. Generating commit message... ? Select a commit message to commit (Use arrow keys) » feat: Add new user profile page fix: Correct CSS styling issues on mobile devices docs: Update API documentation for v2.0 refactor: Optimize database queries for better performance retrygit undo: 撤销上一提交并保留更改git undo
输出:HEAD is now at a1b2c3d Previous commit message Changes from the last commit are now staged.git p:推送当前分支git p
输出:Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 8 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 328 bytes | 328.00 KiB/s, done. Total 3 (delta 2), reused 0 (delta 0), pack-reused 0 To https://github.com/username/repo.git a1b2c3d..e4f5g6h main -> maingit pf:强制推送到当前分支(谨慎使用)git gconfig: 打开 GCOP 配置文件以调整设置
🔧 配置
修改 AI 模型的设置:
- 打开配置文件:
git gconfig - 编辑
config.yaml文件:model: model_name: provider/name, eg openai/gpt-4o api_key: your_api_key - 保存并关闭文件。
📚 了解更多
🛡 授权许可
此项目已在 MIT 许可协议下授权。更多详情请查看 LICENSE。
🤝 支持
如需更多信息,请联系: zeeland4work@gmail.com
查看任何更新,请订阅 Telegram 频道