← 返回 Skills 市场
yang1002378395-cmyk

Git Workflow Cn

作者 yang1002378395-cmyk · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ✓ 安全检测通过
888
总下载
2
收藏
4
当前安装
29
版本数
在 OpenClaw 中安装
/install git-workflow-cn
功能描述
Git 工作流助手 - 分支管理、冲突解决、提交规范。适合:开发者、团队协作。
使用说明 (SKILL.md)

Git 工作流助手 Skill

Git 分支管理、冲突解决、提交规范,提升团队协作效率。

核心功能

功能 描述
分支管理 创建、切换、合并分支
冲突解决 识别和解决冲突
提交规范 Conventional Commits
常见问题 撤销、回滚、恢复

使用方法

分支操作

创建并切换到新分支 feature/login

冲突解决

帮我解决 Git 合并冲突

提交建议

为这些改动生成符合规范的提交信息

常用命令速查

基础操作

# 初始化
git init                           # 初始化仓库
git clone URL                      # 克隆仓库

# 配置
git config --global user.name "Your Name"
git config --global user.email "[email protected]"

# 状态查看
git status                         # 查看状态
git log --oneline                  # 简洁日志
git log --graph --oneline --all    # 图形化日志
git diff                           # 查看改动
git show COMMIT_ID                 # 查看提交详情

分支管理

# 查看分支
git branch                         # 本地分支
git branch -a                      # 所有分支
git branch -r                      # 远程分支

# 创建分支
git branch feature/login           # 创建分支
git checkout -b feature/login      # 创建并切换
git switch -c feature/login        # 新语法

# 切换分支
git checkout feature/login         # 切换分支
git switch feature/login           # 新语法

# 合并分支
git merge feature/login            # 合并分支
git merge --no-ff feature/login    # 禁用快进

# 删除分支
git branch -d feature/login        # 安全删除
git branch -D feature/login        # 强制删除
git push origin --delete feature/login  # 删除远程分支

远程操作

# 查看远程
git remote -v                      # 查看远程仓库
git remote add origin URL          # 添加远程
git remote set-url origin URL      # 修改远程地址

# 拉取推送
git fetch origin                   # 获取更新
git pull origin main               # 拉取并合并
git push origin main               # 推送
git push -u origin feature/login   # 推送并设置上游

# 同步远程
git remote prune origin            # 清理无效引用
git fetch --all --prune            # 获取并清理

暂存操作

# 暂存工作区
git stash                          # 暂存当前修改
git stash save "message"           # 带消息暂存
git stash list                     # 查看暂存列表
git stash pop                      # 恢复并删除
git stash apply                    # 恢复但不删除
git stash drop stash@{0}           # 删除指定暂存
git stash clear                    # 清空暂存

提交规范

Conventional Commits

\x3Ctype>(\x3Cscope>): \x3Csubject>

\x3Cbody>

\x3Cfooter>

Type 类型

Type 描述 示例
feat 新功能 feat(auth): 添加登录功能
fix 修复 bug fix(api): 修复接口超时
docs 文档更新 docs(readme): 更新安装说明
style 代码格式 style: 格式化代码
refactor 重构 refactor(utils): 优化工具函数
perf 性能优化 perf(list): 优化列表渲染
test 测试 test(auth): 添加登录测试
chore 构建/工具 chore: 更新依赖
ci CI 配置 ci: 添加 GitHub Actions
revert 回滚 revert: 回滚登录功能

提交示例

# 功能
git commit -m "feat(user): 添加用户注册功能"

# 修复
git commit -m "fix(payment): 修复支付金额计算错误"

# 文档
git commit -m "docs(api): 更新接口文档"

# 重构
git commit -m "refactor(auth): 重构认证逻辑

- 提取公共方法
- 优化错误处理
- 添加单元测试"

# 破坏性变更
git commit -m "feat(api)!: 修改 API 响应格式

BREAKING CHANGE: 响应格式从 {code, data} 改为 {status, result}"

工作流模式

Git Flow

# 初始化
git flow init

# 功能开发
git flow feature start login
git flow feature finish login

# 发布
git flow release start v1.0.0
git flow release finish v1.0.0

# 热修复
git flow hotfix start fix-login-bug
git flow hotfix finish fix-login-bug

GitHub Flow

# 1. 从 main 创建分支
git checkout -b feature/login main

# 2. 开发并提交
git add .
git commit -m "feat: 添加登录功能"
git push origin feature/login

# 3. 创建 Pull Request
# 4. Code Review
# 5. 合并到 main
git checkout main
git pull origin main
git merge feature/login
git push origin main

GitLab Flow

# 环境分支:main -> staging -> production

# 1. 功能开发
git checkout -b feature/login main
git push origin feature/login

# 2. 合并到 main
git checkout main
git merge feature/login

# 3. 部署到 staging
git checkout staging
git merge main
git push origin staging

# 4. 部署到 production
git checkout production
git merge staging
git push origin production

冲突解决

识别冲突

# 查看冲突文件
git status

# 冲突标记
\x3C\x3C\x3C\x3C\x3C\x3C\x3C HEAD
当前分支内容
=======
合并分支内容
>>>>>>> feature/login

解决冲突

# 1. 手动编辑冲突文件
# 2. 选择保留的内容
# 3. 删除冲突标记
# 4. 添加解决后的文件
git add .
# 5. 完成合并
git commit

冲突工具

# 使用合并工具
git mergetool

# 使用 VS Code
git config --global merge.tool code
git config --global mergetool.code.cmd 'code --wait $MERGED'

# 查看差异
git diff HEAD                     # 与 HEAD 比较
git diff --ours                   # 使用当前版本
git diff --theirs                 # 使用合并版本

常见问题解决

撤销操作

# 撤销工作区修改
git checkout -- file.txt
git restore file.txt              # 新语法

# 撤销暂存
git reset HEAD file.txt
git restore --staged file.txt     # 新语法

# 撤销最近提交(保留修改)
git reset --soft HEAD~1

# 撤销最近提交(丢弃修改)
git reset --hard HEAD~1

# 修改最近提交信息
git commit --amend -m "新信息"

回滚代码

# 回滚指定提交
git revert COMMIT_ID

# 回滚多个提交
git revert COMMIT_ID1..COMMIT_ID2

# 回滚但不提交
git revert --no-commit COMMIT_ID

恢复删除

# 恢复删除的文件
git checkout COMMIT_ID -- file.txt

# 恢复删除的提交
git reflog                        # 查找提交
git reset --hard COMMIT_ID        # 恢复

# 恢复删除的分支
git reflog                        # 找到分支最后的提交
git checkout -b branch_name COMMIT_ID

清理仓库

# 清理未跟踪文件
git clean -n                      # 预览
git clean -f                      # 删除文件
git clean -fd                     # 删除文件和目录

# 清理历史
git filter-branch --force --index-filter \
  'git rm --cached --ignore-unmatch path/to/file' \
  --prune-empty --tag-name-filter cat -- --all

# 使用 BFG(更快)
bfg --delete-folders folder_name
git reflog expire --expire=now --all
git gc --prune=now --aggressive

别名配置

# 添加到 ~/.gitconfig

[alias]
  co = checkout
  br = branch
  ci = commit
  st = status
  unstage = reset HEAD --
  last = log -1 HEAD
  visual = log --graph --oneline --all
  amend = commit --amend --no-edit
  undo = reset --soft HEAD~1
  wip = !git add -A && git commit -m 'WIP'

注意事项

  • 提交前先拉取最新代码
  • 功能分支及时合并
  • 避免直接提交到 main
  • 重要操作先备份

创建:2026-03-12 版本:1.0

安全使用建议
This skill is coherent and appears to do what it says: give Git commands and workflow advice. Before using it, review any commands it suggests — several are destructive (git reset --hard, git clean -f, git filter-branch, history-rewriting with BFG) and can permanently remove data or change repository history. Don’t run commands in the wrong directory; make backups (clone or create a branch) when rewriting history; be careful with global changes (git config --global) because they affect all repos. The skill mentions tools like BFG but does not install them — install and audit such tools separately if you intend to use them. If you want stricter safety, test commands in a disposable clone first.
功能分析
Type: OpenClaw Skill Name: git-workflow-cn Version: 1.1.0 The skill bundle is a comprehensive documentation and command reference for Git workflows, including branch management, conflict resolution, and commit conventions. All provided commands and instructions in SKILL.md are standard Git operations aligned with the stated purpose, with no evidence of malicious intent, data exfiltration, or unauthorized execution.
能力评估
Purpose & Capability
Name/description (Git branch management, conflict resolution, commit conventions) align with the contents of SKILL.md. The only required binary is git, which matches the documented commands and features.
Instruction Scope
Instructions stay within the scope of Git workflows, but include destructive commands (git reset --hard, git clean -f, git filter-branch, reflog/gc and history-rewriting with BFG) and recommend editing global ~/.gitconfig aliases. These are coherent for a Git helper but require user caution because they can permanently change or remove repository data or global config.
Install Mechanism
No install spec and no code files — instruction-only. This minimizes installation risk since nothing is downloaded or written by the skill itself.
Credentials
The skill requests no environment variables, no credentials, and no required config paths. The SKILL.md does suggest editing ~/.gitconfig and mentions external tools (BFG) but does not request unrelated credentials or secrets.
Persistence & Privilege
Skill is not always-enabled and is user-invocable. It recommends changing the user's global git configuration (~/.gitconfig), which is persistent and affects the user's environment — this is reasonable for a Git helper but users should be aware it changes global settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install git-workflow-cn
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /git-workflow-cn 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
优化功能,修复问题
v1.0.52
- No file changes were detected in this release. - Version bumped to 1.0.52 without modifications to skill content or configuration.
v1.0.51
No changes detected in files for this release. - Version number updated; no content or code changes included. - All skill features and documentation remain the same.
v1.0.50
No file changes detected for version 1.0.50. - No updates or modifications were made in this release. - All features and documentation remain the same as the previous version.
v1.0.49
- No changes detected in this release. - Version number updated to 1.0.49.
v1.0.48
Version 1.0.48 - No file changes detected in this version. - No updates or modifications to documentation or functionality.
v1.0.47
- No changes detected in this version; content and files remain the same as the previous release.
v1.0.46
No content or file changes detected in this version. - Version updated to 1.0.46. - No modifications or additions to skill files.
v1.0.45
- No file changes detected in this version. - Functionality remains unchanged from previous releases.
v1.0.44
Version 1.0.44 - No file changes detected in this release. - Content, features, and documentation remain unchanged from the previous version.
v1.0.43
- No file changes detected in this release. - Version number updated from 1.0.0 to 1.0.43. - No functional changes or documentation updates.
v1.0.42
- No changes detected in this release. - Version number updated only; content remains the same as previous version.
v1.0.41
Version 1.0.41 - No file changes detected in this release. - Documentation and functionality remain unchanged from the previous version.
v1.0.40
- Version bumped to 1.0.40. - No changes were made to the files or content in this release.
v1.0.39
No file changes detected in this release. - No updates or modifications were made in version 1.0.39. - Skill behavior and documentation remain unchanged from previous version.
v1.0.38
- No file changes detected in this release. - Version updated to 1.0.38 with no modifications to SKILL.md or other files. - No new features, fixes, or documentation updates in this version.
v1.0.37
No file changes detected in this version. - No modifications were made to the skill files for version 1.0.37. - Functionality and documentation remain unchanged from previous versions.
v1.0.36
- Version updated to 1.0.36, but no file changes detected. - No new features, fixes, or documentation updates in this release.
v1.0.35
- No file changes detected in this version. - Skill functionality and documentation remain the same as the previous release.
v1.0.34
- No changes detected in this release. - Version updated to 1.0.34, but no content modifications were made.
元数据
Slug git-workflow-cn
版本 1.1.0
许可证 MIT-0
累计安装 4
当前安装数 4
历史版本数 29
常见问题

Git Workflow Cn 是什么?

Git 工作流助手 - 分支管理、冲突解决、提交规范。适合:开发者、团队协作。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 888 次。

如何安装 Git Workflow Cn?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install git-workflow-cn」即可一键安装,无需额外配置。

Git Workflow Cn 是免费的吗?

是的,Git Workflow Cn 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Git Workflow Cn 支持哪些平台?

Git Workflow Cn 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Git Workflow Cn?

由 yang1002378395-cmyk(@yang1002378395-cmyk)开发并维护,当前版本 v1.1.0。

💬 留言讨论