with one click
git
分支命名、merge 与 rebase、冲突解决、stash 用法、仓库清理(gc、prune)
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
分支命名、merge 与 rebase、冲突解决、stash 用法、仓库清理(gc、prune)
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
| name | Git 工作流 |
| description | 分支命名、merge 与 rebase、冲突解决、stash 用法、仓库清理(gc、prune) |
| version | 1.0 |
日常 Git 操作的最佳实践和常见命令。
| 类型 | 示例 |
|---|---|
| 功能 | feature/user-login、feat/api-v2 |
| 修复 | fix/payment-bug、hotfix/security-patch |
| 发布 | release/1.2.0 |
| 个人开发 | dev/username、yushen/xxx |
# Merge:保留完整历史,产生合并提交
git checkout main
git merge feature-branch
# Rebase:线性历史,适合个人分支整理
git checkout feature-branch
git rebase main
原则:已推送的公共分支用 merge;个人分支可 rebase 后 force push。
# 1. 拉取/合并触发冲突
git pull origin main
# 或 git merge main
# 2. 查看冲突文件
git status
# 3. 编辑文件,删除 <<<<<<<、=======、>>>>>>> 标记,保留正确内容
# 4. 标记已解决并完成
git add <resolved-files>
git commit # merge 时
# 或 git rebase --continue # rebase 时
# 暂存工作区(含未跟踪文件用 -u)
git stash push -m "WIP: 描述"
git stash push -u -m "含未跟踪"
# 恢复
git stash pop # 应用并移除
git stash apply # 应用但保留
# 列表与操作
git stash list
git stash drop stash@{0}
# 垃圾回收与压缩
git gc --aggressive
# 修剪已删除的远程分支引用
git fetch --prune
git remote prune origin
# 清理悬空对象、过期 reflog
git reflog expire --expire=now --all
git gc --prune=now
生成或审计模块的 SPEC.md。使用场景:用户要求"给 XX 模块写 spec"、"审计所有 spec"、"检查 spec 是否过期"。
Automates SailFish release workflow: fix build/type errors, update CHANGELOG (EN + CN), run npm version with pre/post hooks. Use when the user asks to release, 发版, 发布, bump version, or update changelog.
后端代码修改后,通过 CLI 测试验证功能正确性。使用场景:修改了 electron/services/ 下的代码需要测试、准备提交代码前跑回归、用户要求"跑测试"/"验证一下"。
完成新功能开发或较大修改后,使用本机 Claude CLI 进行代码审查。
使用 ts-morph 静态分析工具查询代码结构(类层次、方法签名、引用、依赖等),替代手动读源码。使用场景:需要了解类的方法/属性、继承链、符号引用、文件结构、依赖关系时。
When committing or staging changes, only include files related to the current task or conversation; do not stage or commit unrelated modifications. Use when the user asks to commit, stage, 提交, or when preparing to run git add/commit.