This skill helps you complete the entire code commit process, from analyzing changes to generating commit messages, then to local commits and remote pushes.
Execution Rules (Must Be Followed)
After the user selects an operation, all of the following commands must be executed immediately; asking for confirmation again is prohibited:
git add- Execute directly, do not askgit commit- Execute directly, do not askgit push- Execute directly, do not ask
Only one interaction is allowed in the entire process: let the user choose an operation (push to remote / commit locally only / cancel). Execute immediately after selection, without any additional confirmation steps.
When to Use This Skill
- Commit code after completing feature development
- Commit changes after fixing a bug
- Commit after refactoring code
- Any scenario where code changes need to be committed to git
Workflow
This skill executes in the following steps:
1. Analyze changes
Automatically run git status and git diff to analyze the current changes, including:
- Added/modified/deleted files
- Specific code change contents
- Types of changes (new feature, bug fix, refactor, documentation update, etc.)
2. Generate commit message
Automatically generate a standardized commit message based on the change contents, including:
- Concise title (within 50 characters)
- Detailed description
- Change type tag (feat/fix/refactor/docs/style/test/chore)
- Co-Authored-By marker
3. Display the commit message and choose an operation
Show the generated commit message to the user, then provide three options to choose from:
Please choose an operation:
- Push to remote - Execute the local commit and then immediately push to the remote repository
- Commit locally only - Only execute the local commit, do not push to remote
- Cancel - Cancel this commit operation
- The user may also modify the commit message first, then choose one of the above operations
4. Execute immediately
Important: After the user selects an operation, immediately execute the corresponding git command without asking for confirmation again.
5. After the commit is complete, ask whether to merge into the test branch
After the commit (or push) succeeds, perform the following steps:
-
Run
git branch -ato get the list of all branches -
Identify the test branch from the branch list: prioritize matching branches whose names contain
test、testing、staging、dev、develop、uat、qa(either local or remote) -
If a test branch is found, ask the user:
Commit successful! Do you want to merge the current branch into the test branch?
- [1] Merge into
<测试分支名>- Executegit checkout <测试分支> && git merge <当前分支> && git checkout <原分支> - [2] Skip - Do not perform the merge
- [1] Merge into
-
If multiple test branches are found, list all candidate branches for the user to choose from
-
If no test branch is found, skip this step and do not ask
Usage
Trigger with the shortcut command:
/git
Modify commit message
/git,提交信息改成:修复登录页面样式问题
/git,用这个信息:feat 添加用户头像上传功能
Example
User: /git
Execution flow:
-
Analyzing changes...
modified: src/components/UserProfile.tsx modified: src/services/auth.ts new file: src/types/user.ts -
Generated commit message:
feat: 添加用户资料页和类型定义 - 新增 UserProfile 组件 - 完善 auth 服务中的用户信息获取 - 添加 user 类型定义 Co-Authored-By: Claude (glm-4.6) <noreply@anthropic.com> -
Please choose an action:
- [1] Push to remote
- [2] Commit locally only
- [3] Cancel
-
After the user selects [1], execute directly:
git add . git commit -m "feat: 添加用户资料页和类型定义..." git push(no need to confirm again)
Commit Message conventions
This skill follows the Conventional Commits specification:
- feat: New feature
- fix: Bug fix
- refactor: Code refactoring
- docs: Documentation update
- style: Code formatting adjustment
- test: Test-related
- chore: Build/tooling-related
Notes
- Automatically skip sensitive files (.env, key files, etc.)
- Will not perform force push or dangerous operations
- Before committing, all files to be committed will be displayed
- If there are no changes, a friendly prompt will be shown