git-integrate — Claude Code skill: rebase, merge, cherry-pick
Drives a rebase, merge, cherry-pick or revert through verified completion and leaves unrelated work alone. Useful when an operation stalls on a conflict.
npx skills add LegendApp/legend-skills --skill git-integrate -a claude-codeWhat git-integrate does
The skill owns one history operation and finishes it. It starts by reading git status plus the state of rebase-merge, MERGE_HEAD, CHERRY_PICK_HEAD and REVERT_HEAD to see what is already running. If an operation is active, it continues that one instead of starting a new one.
Conflicts get handled path by path. Where the intended result is clear from history, callers and tests, the skill edits the files, strips markers and stages only the resolved paths. Where behaviour diverges or stays unclear, it stops and asks. Automatic resolutions and rerere count as untrusted proposals.
This is not a general Git runner: it will not pick an integration strategy or do side commit, branch, stash, reset and worktree chores. A new operation needs an explicit method and target, because the skill refuses to guess. A wrong history operation is worse than an interruption — that is the reasoning behind the hard stop.
What it helps with
- finish a rebase that stopped on a conflict
- resolve a cherry-pick conflict file by file
- continue a merge without losing unrelated edits
- revert a commit with the right mainline parent
- work out which history operation is already in progress
Example prompts for the agent
- Continue the rebase that stopped on a conflict and finish it
- Cherry-pick these commits in order
- Revert the last commit
How to install git-integrate
1Skills CLI (Vercel)
npx skills add LegendApp/legend-skills --skill git-integrate -a claude-code2Manually: put the files in place
~/.claude/skills/git-integrate/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/git-integrate/
1Skills CLI (Vercel)
npx skills add LegendApp/legend-skills --skill git-integrate -a codex2Manually: put the files in place
.agents/skills/git-integrate/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add LegendApp/legend-skills --skill git-integrate -a cursor2Manually: put the files in place
.cursor/skills/git-integrate/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install LegendApp/legend-skills git-integrate2Manually: put the files in place
.github/skills/git-integrate/SKILL.md1Skills CLI (Vercel)
npx skills add LegendApp/legend-skills --skill git-integrate -a gemini-cli2Platform CLI
gemini skills install https://github.com/LegendApp/legend-skills --path git-integrateManually: put the files in place
.devin/skills/git-integrate/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add LegendApp/legend-skills --skill git-integrate -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about git-integrate
How do I install git-integrate in Claude?
Run npx skills add LegendApp/legend-skills --skill git-integrate -a claude-code. The skill lands in ~/.claude/skills/git-integrate/SKILL.md.
What does git-integrate do?
It runs a rebase, merge, cherry-pick or revert through verified completion. When one is already in progress, it continues or repairs it while preserving the intended history and unrelated work.
What do I need to specify before a new operation?
The method and its exact history effect: branch, upstream and commits for a rebase, the fast-forward policy for a merge, commits and order for cherry-pick and revert. Without that the skill stops and asks.
Source text
SKILL.md · MIT
--- name: git-integrate description: "Run or resume a requested rebase, merge, cherry-pick, or revert while preserving intended history and unrelated work." --- # Git Integrate Own a rebase, merge, cherry-pick, or revert through verified completion. When the user requests integration or recovery and one is in progress, continue or repair it. An unrelated task, audit, or question does not authorize resuming history. Otherwise start the operation explicitly requested by the user. This is not a general Git command runner: do not choose an integration strategy or perform unrelated commit, branch, stash, reset, remote, or worktree maintenance. > **Hard stop:** For new work, proceed when the requested operation and intended history are established by the request, repository policy, or existing configuration. For an in-progress operation, continue it without requiring the user to restate its method or target when Git state makes the operation and next action clear. Resolve a conflict only when its intended result is also clear from repository evidence. Otherwise stop before mutating Git or files and ask the user with concrete options. Never choose a default; an incorrect history operation or resolution is worse than an interruption. ## Workflow 1. **Inspect state.** Run full `git status`, `git status --short --branch`, and `scripts/inspect-operation.sh` when available. Record the current branch and `HEAD`. Resolve `rebase-merge`, `rebase-apply`, `MERGE_HEAD`, `CHERRY_PICK_HEAD`, `REVERT_HEAD`, and the sequencer directory with `git rev-parse --git-path`. Active Git state determines the operation to continue; do not start another or ask the user to choose a new method or target. It does not by itself establish the intended combined behavior or prove that `--continue` is the correct immediate action. 2. **Continue an active operation.** Read `git status`, the operation metadata and todo state, the current operation commit, unmerged index stages, staged changes, and working-tree changes. Determine whether the operation is ready to continue or stopped for a conflict, an edit instruction, a failed exec, an empty commit, a pending commit, or another reason. Route conflicts through the resolution workflow below. For an edit or failed exec, verify the requested edit or command result before continuing. For an empty commit, require explicit approval before keeping, dropping, or skipping it. If the stop reason or next action is unclear, preserve the exact state and ask; never blindly continue an operation merely because it is active. 3. **Preflight a new operation.** With no active operation, require an explicit method and enough information to determine its exact history effect: - Rebase: current or named source branch, upstream, commits to replay, and whether the request requires `--onto`, `--rebase-merges`, `--update-refs`, autosquash, or another non-default form. - Merge: source and target plus the intended fast-forward policy: `--ff-only`, allow a fast-forward, or require a merge commit with `--no-ff`. - Cherry-pick: exact commits, order, and whether an empty result should stop, drop, or be kept. - Revert: exact commits, order, and the confirmed `-m <parent>` for every merge commit. Resolve named refs to commit IDs and inspect the merge base, divergence, commits, and relevant diff before mutating history. Identify pre-existing staged, unstaged, and untracked changes; proceed with them present only when their ownership and non-interaction are clear. Fetch only the required remote or ref when freshness matters. Inspect behavior-affecting configuration such as `merge.ff`, `rebase.autoStash`, `rebase.rebaseMerges`, `rebase.updateRefs`, and `rerere.enabled`; use explicit flags or ask when configuration would materially change the result. Do not choose an unrequested integration method, change intended topology, or stash unrelated work. Use established repository configuration for routine options; ask when alternatives would materially change the requested result. Record the original branch, `HEAD`, and relevant refs so the final history can be compared. 4. **Start the confirmed operation.** Construct the command from the confirmed history shape rather than forcing every request through a simple form. Basic forms include `git rebase <upstream>`, `git merge --no-edit --ff-only <source>`, `git merge --no-edit --ff <source>`, `git merge --no-edit --no-ff <source>`, `git cherry-pick <commits>`, and `GIT_EDITOR=true git revert <commits>`. Add variant flags or `-m <parent>` only when confirmed. Run non-interactively when doing so preserves the requested commit messages and behavior. 5. **Inspect every conflict before editing.** Check `git diff --name-only --diff-filter=U`, `git ls-files -u`, `git diff --cc`, markers, and the exact change represented by `REBASE_HEAD`, `CHERRY_PICK_HEAD`, `REVERT_HEAD`, or `MERGE_HEAD`. Use surrounding history, callers, tests, and docs to state the intended result and evidence for every path. Resolve independent paths whose intended result is established. Preserve and ask about paths with unresolved competing behavior; do not let those prevent inspection or preparation of clear resolutions. Report the exact Git state and paths, explain the competing intents and evidence, and offer concrete options. You may identify the likeliest option but must not select it. Always ask for divergent behavior, unclear delete/modify conflicts, uncertain binary/lock/generated files, competing refactors or evidence, and missing mainline parents. Formatting, imports, non-overlapping edits, moves, and generated files are direct only when repository evidence verifies the result. 6. **Resolve and verify.** Treat staged resolutions, `rerere`, merge drivers, and automatic resolutions as untrusted proposals. Once every path is clear, edit the files, regenerate generated output from its source, remove all markers, and stage only resolved paths. Verify no unmerged entries remain, review the staged resolution, and run the fastest meaningful focused check when the intermediate state is testable. Never accept `ours`, `theirs`, union merge, or generated output wholesale without independent verification. 7. **Continue the in-progress operation.** When Git state shows that the current step is ready, including after resolving a conflict or confirming a pending operation commit, use the matching command: - `GIT_EDITOR=true git rebase --continue` - `GIT_EDITOR=true git merge --continue` - `GIT_EDITOR=true git cherry-pick --continue` - `GIT_EDITOR=true git revert --continue` Reinspect state after every continuation. Apply the same classification and hard stop to each subsequent pause; do not use `--continue` for a different stop reason without verifying its required action. 8. **Verify completion.** Confirm the operation state files are gone, the final branch and `HEAD` are expected, and the requested commits and topology are present without accidental drops or duplicates. For a non-trivial rebase, compare the old and new series with `git range-diff` or equivalent evidence when practical. Run focused validation, inspect final status and remaining changes, then report the operation, resolved paths, history verification, validation, and remaining tree state. ## Ours And Theirs - Rebase: `ours` is the accumulated rebased result on the new base, including commits already replayed; `theirs` is the commit currently being replayed. - Merge: `ours` is the current branch; `theirs` is the branch being merged. - Cherry-pick: `ours` is the current `HEAD`, including earlier picks in the sequence; `theirs` is the commit being applied. - Revert: infer nothing from the labels; compare current `HEAD`, the reverted commit, its selected parent, and the index stages. ## Safety Never use destructive resets, abort or quit an operation, skip or drop commits, overwrite unrelated changes, or change the requested history topology without explicit approval. If completion is unclear or unsafe, preserve the exact state and ask whether to provide resolution guidance, use the matching recovery command, or choose another integration strategy. `scripts/inspect-operation.sh` prints the active operation, current branch and commit, operation metadata, staged and conflicted paths, index stages, and marker locations.
© LegendApp · MIT · LegendApp/legend-skills