npx skills add https://github.com/jezweb/claude-skills --skill git-workflow针对常见 Git 操作的引导式工作流,通过结构化步骤提升效率。
准备拉取请求时:
收集上下文
git log main..HEAD --oneline — 列出分支上的所有提交git diff main...HEAD --stat — 查看所有更改的文件git status — 检查未提交的工作草拟 PR 内容
推送并创建
git push -u origin HEAD
gh pr create --title "..." --body "$(cat <<'EOF'
## Summary
- ...
## Test plan
- [ ] ...
🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
验证 — gh pr view --web 在浏览器中打开
安全地清理已合并的分支:
切换到主分支并拉取最新内容
git checkout main && git pull
列出已合并的分支(排除 main/master/develop)
git branch --merged main | grep -vE '^\*|main|master|develop'
删除本地已合并的分支
git branch --merged main | grep -vE '^\*|main|master|develop' | xargs -r git branch -d
清理远程跟踪引用
git fetch --prune
列出没有本地跟踪的远程分支(可选)
git branch -r --merged origin/main | grep -vE 'main|master|develop|HEAD'
当 PR 出现冲突时:
评估冲突范围
git fetch origin
git merge origin/main --no-commit --no-ff
git diff --name-only --diff-filter=U # 列出冲突文件
对于每个冲突文件,读取文件并解决:
如果变基更清晰(提交少,无共享历史):
git rebase origin/main
# 按提交解决冲突,然后:
git rebase --continue
如果变基很混乱(冲突多,架构分歧大):
git rebase --abort 或 git merge --abortgit show origin/branch:path/to/file > /tmp/extracted.txt验证 — 运行测试,检查差异看起来是否正确
在单体仓库中,将标签限定到特定包:
# ❌ 在单体仓库中含义模糊
git tag v2.1.0
# ✅ 限定到包
git tag contextbricks-v2.1.0
git push origin contextbricks-v2.1.0
模式:{包名称}-v{语义化版本号}
创建新仓库时,务必在首次 git add 之前创建 .gitignore:
cat > .gitignore << 'EOF'
node_modules/
.wrangler/
dist/
.dev.vars
*.log
.DS_Store
.env
.env.local
EOF
git init && git add . && git commit -m "Initial commit"
如果 node_modules 已被跟踪:
git rm -r --cached node_modules/
git commit -m "Remove node_modules from tracking"
在发布或共享私有仓库之前:
gh repo view --json visibility -q '.visibility'
如果显示 PRIVATE,请确保:
LICENSE 文件包含专有声明(非 MIT/Apache)package.json 中包含 "license": "UNLICENSED" 和 "private": trueCONTRIBUTING.md 或“欢迎贡献”字样每周安装数
211
仓库
GitHub 星标数
643
首次出现
14 天前
安全审计
安装于
cursor200
gemini-cli199
cline199
github-copilot199
codex199
opencode199
Guided workflows for common git operations that benefit from structured steps.
When preparing a pull request:
Gather context
git log main..HEAD --oneline — list all commits on the branchgit diff main...HEAD --stat — see all changed filesgit status — check for uncommitted workDraft PR content
Push and create
git push -u origin HEAD
gh pr create --title "..." --body "$(cat <<'EOF'
## Summary
- ...
## Test plan
- [ ] ...
🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"
Verify — gh pr view --web to open in browser
Clean up merged branches safely:
Switch to main and pull latest
git checkout main && git pull
List merged branches (excludes main/master/develop)
git branch --merged main | grep -vE '^\*|main|master|develop'
Delete local merged branches
git branch --merged main | grep -vE '^\*|main|master|develop' | xargs -r git branch -d
Prune remote tracking refs
git fetch --prune
List remote branches with no local tracking (optional)
git branch -r --merged origin/main | grep -vE 'main|master|develop|HEAD'
When a PR has conflicts:
Assess the conflict scope
git fetch origin
git merge origin/main --no-commit --no-ff
git diff --name-only --diff-filter=U # List conflicted files
For each conflicted file , read the file and resolve:
If rebase is cleaner (few commits, no shared history):
git rebase origin/main
# Resolve conflicts per commit, then:
git rebase --continue
If rebase is messy (many conflicts, architectural divergence):
git rebase --abort or git merge --abortgit show origin/branch:path/to/file > /tmp/extracted.txtIn monorepos, scope tags to the package:
# ❌ Ambiguous in monorepos
git tag v2.1.0
# ✅ Scoped to package
git tag contextbricks-v2.1.0
git push origin contextbricks-v2.1.0
Pattern: {package-name}-v{semver}
When creating a new repo, always create .gitignore BEFORE the first git add:
cat > .gitignore << 'EOF'
node_modules/
.wrangler/
dist/
.dev.vars
*.log
.DS_Store
.env
.env.local
EOF
git init && git add . && git commit -m "Initial commit"
If node_modules is already tracked:
git rm -r --cached node_modules/
git commit -m "Remove node_modules from tracking"
Before publishing or sharing a private repo:
gh repo view --json visibility -q '.visibility'
If PRIVATE, ensure:
LICENSE contains proprietary notice (not MIT/Apache)package.json has "license": "UNLICENSED" and "private": trueCONTRIBUTING.md or "contributions welcome" in READMEWeekly Installs
211
Repository
GitHub Stars
643
First Seen
14 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
cursor200
gemini-cli199
cline199
github-copilot199
codex199
opencode199
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
119,800 周安装
Verify — run tests, check the diff looks right