一键导入
git-mastery
Advanced Git: rebase, bisect, reflog, cherry-pick, worktrees, LFS. Triggers: rebase, bisect, cherry-pick, reflog, force push, merge conflict, worktree.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Advanced Git: rebase, bisect, reflog, cherry-pick, worktrees, LFS. Triggers: rebase, bisect, cherry-pick, reflog, force push, merge conflict, worktree.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
REST/GraphQL API design: naming, versioning, pagination, idempotency, OpenAPI. Triggers: API design, REST, GraphQL, OpenAPI, Swagger, idempotency, rate limit.
Direct technical voice for docs, README, user-facing text. Concise/strict modes. Triggers: documentation, README, content, output-mode, voice, prose style.
Multi-source web research methodology: retrieve-vs-answer gate, complexity-scaled search budget, query craft, primary-source preference, source-conflict skepticism, adversarial verification, attribution-without-reproduction. Triggers: deep research, multi-source, web research, synthesize sources, cross-reference, fact synthesis, source verification.
UI craftsmanship: animation rules, easing, micro-interactions, state polish. Triggers: animation, transition, ease-out, motion, micro-interaction, hover, loading state, UI polish.
Builds production MCP servers via 4-phase methodology: research, implement, test, evaluate. Triggers: build MCP, new MCP, MCP integration, MCP server scaffold.
MCP server design: tool schemas, resources, stdio/SSE, capability negotiation. Triggers: MCP, Model Context Protocol, JSON-RPC, stdio, SSE, Claude Desktop.
| name | git-mastery |
| description | Advanced Git: rebase, bisect, reflog, cherry-pick, worktrees, LFS. Triggers: rebase, bisect, cherry-pick, reflog, force push, merge conflict, worktree. |
| effort | medium |
| user-invocable | false |
| allowed-tools | Read, Grep, Glob |
main / master / develop.--force-with-lease instead of --force.git branch backup/feature-xyz-pre-rebaseFind the specific commit that introduced a bug.
# Start
git bisect start
git bisect bad # Current version is broken
git bisect good <commit-sha> # Version that worked
# Automate with test script
git bisect run pytest tests/test_failing_feature.py
Clean up commit history before merge.
git rebase -i HEAD~n
Visualize branch topology.
git log --graph --oneline --decorate --all
Recover "lost" commits after a bad reset/rebase.
git reflog
git reset --hard HEAD@{n}
Pick specific commits from other branches.
git cherry-pick <commit-sha>
# If valid conflict
git add .
git cherry-pick --continue
feat: New featurefix: Bug fixdocs: Documentation onlystyle: Formatting (white-space, etc)refactor: Code change that neither fixes a bug nor adds a featureperf: Performance improvementtest: Adding missing testschore: Build process/auxiliary tools| Excuse | Why It's Wrong |
|---|---|
| "I'll clean up commits later" | Later means never — write clean commits as you go |
| "Force push is fine on my branch" | Others may have fetched your branch — use --force-with-lease |
| "One big commit is simpler" | Big commits are impossible to review, bisect, or revert — keep them atomic |
| "Merge conflicts mean someone else's problem" | Conflicts mean you diverged too long — rebase frequently to stay aligned |
| "Commit messages don't matter" | Messages are documentation — future you needs to understand why, not just what |
--force-with-lease instead of --force for any force operation on a shared branchgit branch backup/<name>-pre-rebasemain, master, or develop — these are shared trunk branches by conventiongc.reflogExpire) — tag anything you want to keep longer. Do not rely on reflog for multi-month recovery.feat:, fix:, docs:, refactor:, test:, chore:) — drift defeats automated changelog and release toolinggit bisect relies on each commit being testable. Flaky tests corrupt the bisection silently — a flaky "bad" mark sends bisect down the wrong half. Run the test 3× at the boundary commits if flakiness is known.git cherry-pick <sha> of a merge commit fails without --mainline 1 (or 2). The error is cryptic ("commit is a merge but no -m option was given"); the fix is simple but non-obvious.git reflog entries expire by default in 90 days (gc.reflogExpire) and unreferenced commits get garbage-collected after 30 days (gc.reflogExpireUnreachable). Long-term recovery of "lost" commits from reflog is not guaranteed.git rebase -i --root is supposed to include the very first commit, but on shallow clones (--depth N) the "root" is the shallow boundary, not the actual initial commit. Run git fetch --unshallow before rebasing --root.git filter-branch is deprecated and slow (shell-based, re-forks per commit). Use git filter-repo for history rewriting — it is a separate tool (pip install git-filter-repo) but 100× faster and endorsed by the Git maintainers.git pull --rebase on a branch with unpushed merge commits rewrites those merges into linear history, silently losing the merge metadata. If a merge was intentional (e.g., to preserve feature-branch context), use git pull --no-rebase or set pull.ff=only globally./commit/pr/debug on the git output/ci-cd-patterns.git/hooks/* content — this skill is user-facing Git; hook mechanics live in /hook-creator and install_git_hooks.py