别着急,坐和放宽
最近在 阮老师博客 看到一款这个 GCOP,一个基于 LLM 的 Git 提交消息生成和 Git 工作流程优化工具,试用了一下确实不错。接入 LLM 即可自动分析 git 修改生成 commit 消息,比我之前做的 git-commit 生成器好用多了。
以下是一些简单介绍:
GCOP (Git Copilot) 是一个 Git 智能助手,它使用 AI 来自动生成 Git 提交消息,帮助开发者优化 Git 工作流程。
git c 用于 AI 辅助提交,优化 Git 工作流程🎨 高度可定制化体验
⚡ 流畅的开发者体验
📚 智能学习能力
项目完全开源,使用 MIT 协议,基于 Python 开发。
Github: https://github.com/Undertone0809/gcop
官网: https://gcop.zeeland.top/
安装配置参考官网 Quick Start Guide 即可,mac 下可以结合 conda 安装,之后大概按照这样配置:
model:
model_name: openai/gpt-4o-mini
api_key: sk-xxxx
api_base: https://api.xxx.io/v1
即可使用。
效果
常用命令
改好代码之后 git ac && git push 两行命令搞定标准格式提交,很方便。
(base) songtianlun@songtianlundeMacBook-Air sample_rails_app % git ac
[Code diff]
diff --git a/.gitignore b/.gitignore
index afd85fd..daa7023 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,3 +37,5 @@
!/app/assets/builds/.keep
/node_modules
+
+.idea
[On Ready] Generating commit message...
[Thought] The changes involve the removal of several .idea configuration files and the
addition of .idea to the .gitignore file. This indicates a cleanup of IDE-specific files
that are not necessary for version control, which can help reduce clutter in the repository.
[Generated commit message]
chore: remove IDE configuration files
- Deleted .idea/misc.xml, .idea/modules.xml, and .idea/sample_rails_app.iml files
- Added .idea to .gitignore to prevent future IDE files from being tracked
This commit cleans up the repository by removing IDE-specific configuration files that are
not needed for the project. It also ensures that any future IDE files will be ignored,
keeping the repository clean and focused on the actual project code.
? Do you want to commit the changes with this message? yes
[main d86005c] chore: remove IDE configuration files
6 files changed, 2 insertions(+), 373 deletions(-)
delete mode 100644 .idea/.gitignore
delete mode 100644 .idea/misc.xml
delete mode 100644 .idea/modules.xml
delete mode 100644 .idea/sample_rails_app.iml
delete mode 100644 .idea/vcs.xml
(base) songtianlun@songtianlundeMacBook-Air sample_rails_app % git push
$ git ghelp
/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/pydantic/_internal/_config.py:345: UserWarning: Valid config keys have changed in V2:
* 'fields' has been removed
warnings.warn(message, UserWarning)
gcop is your local git command copilot
Version: 1.7.3
GitHub: https://github.com/Undertone0809/gcop
Usage: gcop [OPTIONS] COMMAND
Commands:
git p Push the changes to the remote repository
git pf Push the changes to the remote repository with force
git undo Undo the last commit but keep the file changes
git ghelp Add command into git config
git gconfig Open the config file in the default editor
git gcommit Generate a git commit message based on the staged changes and commit the
changes
git c The same as `git gcommit` command
git ac The same as `git add . && git gcommit` command
git acp The same as `git add . && git gcommit && git push` command
git cp The same as `git gcommit && git push` command
git amend Amend the last commit, allowing you to modify the commit message or add
changes to the previous commit
git info Display basic information about the current git repository