跳到正文
cccskills
免费在 GitHub 公开

ls-git-merge-rebase

Advanced git operations beyond add/commit/push. Use when rebasing, bisecting bugs, using worktrees for parallel development, recovering with reflog, managing subtrees/submodules, resolving merge conflicts, cherry-picking across branches, or working with monorepos.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(5)

  • SKILL.md4.3 KB
  • references/rebase-and-bisect.md3.1 KB
  • references/repo-structure-and-conflicts.md4.4 KB
  • references/tags-releases-and-tips.md1.7 KB
  • references/worktrees-recovery-and-history.md4.2 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Git Workflows

Use this skill for advanced Git operations that can rewrite history, move work between branches, recover lost commits, or manage large and multi-repository codebases. Keep this file as the activation and safety workflow; open the references only for the procedure you need.

When to Use

  • Cleaning up commit history before merging.
  • Finding which commit introduced a bug.
  • Working on multiple branches at the same time.
  • Recovering lost commits, dropped stashes, or mistaken resets.
  • Cherry-picking commits across branches or forks.
  • Managing subtrees, submodules, or sparse checkouts.
  • Resolving complex merge or rebase conflicts.
  • Inspecting history with blame, pickaxe, or file-following log commands.

Safety Workflow

  1. Inspect the repository before changing it:
git status --short --branch
git remote -v
git branch --show-current
  1. Identify whether the target branch is shared. Do not rebase, amend, reset, or force-push shared history unless the user explicitly asks for that operation.
  2. Preserve unrelated work. If the worktree is dirty, only stage or modify files that belong to the task.
  3. Before every git reset --hard, require a clean worktree. Preserve desired staged, unstaged, and relevant untracked work first with an approved WIP commit, patch, stash (use -u when needed), or separate worktree. A backup branch or tag preserves only commits; it does not preserve uncommitted work.
git status --short
git stash push -u -m "WIP before recovery"
git branch backup/before-recovery
  1. Prefer non-interactive commands when automating. Use interactive rebase only when the user can review the intended commit list or the change is clearly local and scoped.
  2. After each operation, re-check status and confirm the branch, staged files, and diff match the requested outcome.

Rule ownership

This skill owns advanced Git operations and traceability behavior. GIT_TRACEABILITY.md is the public reference; use this skill for branch, history, worktree, release-tag, and checkpoint decisions.

  • Preserve unrelated dirty-tree work.
  • Record commit hashes or branch names when a decision depends on a past state.
  • Use ls-git-broken-state-recovery for broken worktree/index/ref symptoms instead of improvising repair steps here.

Workflow Router

Open the matching reference and follow only that recipe:

Quick Triage

Use these read-only commands before selecting a recipe:

git log --oneline --decorate --graph -20
git diff --stat
git diff --cached --stat
git reflog --date=relative -20

For branch divergence:

git fetch --all --prune
git status --short --branch
git log --oneline --left-right --cherry-pick HEAD...@{upstream}

If an operation is already in progress, inspect Git's state before continuing:

git status
git rebase --show-current-patch
git diff --cc

Completion Checks

  • git status --short --branch shows the expected branch and worktree state.
  • git diff --stat and git diff --cached --stat match the task scope.
  • Any rewritten or moved commits were verified with git log --oneline --graph.
  • Recovery work leaves a named branch or clear reflog handle for rollback when the operation could discard reachable work.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Guide accessibility reviews for UI, documents, and workflows. Use for WCAG-oriented audits, keyboard review, semantics, contrast, and remediation planning.

中文简介正在准备中。当前显示原文说明。

CruxExperts/LocalSetup62026年10月22日 更新

Use when choosing a LocalSetup Agent-* lane for exploration, research, bounded implementation, or review. Consult the static capability matrix; do not probe account or network availability.

中文简介正在准备中。当前显示原文说明。

CruxExperts/LocalSetup62026年10月22日 更新

Guide agent email inbox workflows with prompt-injection defenses. Use for inbound email processing, webhooks, routing, and safety review.

中文简介正在准备中。当前显示原文说明。

CruxExperts/LocalSetup62026年10月22日 更新

Navigate and understand codebases using agentlens hierarchical documentation. Use when exploring new projects, finding modules, locating symbols in large files, finding TODOs/warnings, or understanding code structure.

中文简介正在准备中。当前显示原文说明。

CruxExperts/LocalSetup62026年10月22日 更新

Use for Agent Q signed encrypted file-drop or mail ship and ingest, private registry v2 setup, queue status, and transport maintenance.

中文简介正在准备中。当前显示原文说明。

CruxExperts/LocalSetup62026年10月22日 更新

Inventory wrapper for the alirezarezvani Claude skills bundle. Use when triaging its broad skill catalog and large script surface before any targeted import.

中文简介正在准备中。当前显示原文说明。

CruxExperts/LocalSetup62026年10月22日 更新

查看 CruxExperts 的全部技能

报告此技能的问题