
Git Workflow Cn
- 8 installs
- 33 repo stars
- Updated April 26, 2026
- bighardperson/computer-science-skills-collection
git-workflow-cn is a skill assisting with Git branch management, conflict resolution, and commit conventions for developers and teams.
About
git-workflow-cn is a Git workflow assistant covering branch management, conflict resolution, and commit conventions for developers and teams. It documents Conventional Commits, three workflow models (Git Flow, GitHub Flow, GitLab Flow), and recipes for undoing, rolling back, and recovering changes. A developer uses it as a Chinese-language reference to improve team collaboration on Git.
- Branch management, conflict resolution, and Conventional Commits guidance
- Covers Git Flow, GitHub Flow, and GitLab Flow workflow models
- Command cheat sheets and undo/rollback/recovery recipes in Chinese
Git Workflow Cn by the numbers
- 8 all-time installs (skills.sh)
- Ranked #443 of 735 Git & Pull Requests skills by installs in the Skillselion catalog
- Data as of Jul 30, 2026 (Skillselion catalog sync)
git-workflow-cn capabilities & compatibility
Free; requires only git
- Capabilities
- git workflow · conflict resolution · commit conventions
- Works with
- github · gitlab
- Use cases
- documentation
- Pricing
- Free
What git-workflow-cn says it does
Git 工作流助手 - 分支管理、冲突解决、提交规范。适合:开发者、团队协作。
Git 分支管理、冲突解决、提交规范,提升团队协作效率。
### Conventional Commits
npx skills add https://github.com/bighardperson/computer-science-skills-collection --skill git-workflow-cnAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 8 |
|---|---|
| repo stars | ★ 33 |
| Last updated | April 26, 2026 |
| Repository | bighardperson/computer-science-skills-collection ↗ |
What it does
Reference Git branching, conflict resolution, and Conventional Commit conventions for team collaboration.
Who is it for?
Team Git workflows, conflict resolution, and Conventional Commit conventions.
Skip if: GitHub-API automation or AI-generated commits.
When should I use this skill?
You need branch, conflict, or commit-convention guidance for a Git workflow.
What you get
Git branching, conflicts, and commit messages follow a documented team convention.
- Git workflow guidance
- Conventional Commit messages
- Conflict resolution steps
By the numbers
- 10 Conventional Commit types listed
- 3 workflow models (Git Flow, GitHub Flow, GitLab Flow)
Files
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@example.com"
# 状态查看
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
<type>(<scope>): <subject>
<body>
<footer>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-bugGitHub 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 mainGitLab 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
# 冲突标记
<<<<<<< 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
{
"ownerId": "kn7a0nk2nhyhkcwjry4knbqngn82qxtg",
"slug": "git-workflow-cn",
"version": "1.1.0",
"publishedAt": 1773643774371
}{
"version": 1,
"registry": "https://clawhub.ai",
"slug": "git-workflow-cn",
"installedVersion": "1.1.0",
"installedAt": 1776071162630
}
Related skills
FAQ
Which workflow models does git-workflow-cn cover?
Git Flow, GitHub Flow, and GitLab Flow.
What commit standard does it use?
Conventional Commits, with a table of types such as feat, fix, docs, and refactor.