Skip to content
Agentmart
Submit a tool

wt-commit

Use this skill when a task is finished and its changes need to be committed — either in a git worktree on a detached HEAD (commit the pending changes and…

Skill by ansidev

IndexedMIT
Write a review

Chalk Labs

Need help deploying wt-commit?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/ansidev-wt-commit

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use this skill when a task is finished and its changes need to be committed — either in a git worktree on a detached HEAD (commit the pending changes and cherry-pick the commit onto <base_ref>, the branch the worktree was created from) or directly on the main/base branch (commit in place). Trigger whenever the user asks to commit worktree changes, land worktree changes onto a branch, finish a worktree-based task by moving its commit to <base_ref>, or commit finished task work on the main branch.

Use cases: productivity

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/wt-commit

What's inside

Skill name
wt-commit
Description
Use this skill when a task is finished and its changes need to be committed — either in a git worktree on a detached HEAD (commit the pending changes and cherry-pick the commit onto <base_ref>, the branch the worktree was created from) or directly on the main/base branch (commit in place). Trigger whenever the user asks to commit worktree changes, land worktree changes onto a branch, finish a worktree-based task by moving its commit to <base_ref>, or commit finished task work on the main branch.
License
MIT
Instructions
53 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# wt-commit

## When to use

The task is finished and its changes need to be committed and landed. Two contexts are supported:

- **Worktree context:** you are in a git worktree on a detached HEAD. Commit the working changes and land the commit onto `<base_ref>`, which is the branch the task worktree was created from.
- **Main-branch context:** you are already on the base branch (for example `main`) in the main worktree. Commit the pending task changes in place; no cherry-pick or stash is needed.

`<base_ref>` is the branch the task worktree was created from, or simply the current branch in the main-branch context. If the user did not state it explicitly, infer it from the worktree setup (for example the taskboard issue's base branch, or the fork point recorded when the worktree was created); if it cannot be determined, ask.

## Safety rules

- Do not run destructive commands: `git reset --hard`, `git clean -fdx`, `git worktree remove`, or `rm`/`mv` on repository paths.
- Do not edit files outside git workflows unless required for conflict resolution.
- Preserve any pre-existing user uncommitted changes in the base worktree.

## Steps

0. Determine the context by running `git rev-parse --abbrev-ref HEAD` and `git rev-parse --git-dir`:
   - Detached HEAD → worktree context; follow steps 1–9.
   - On a branch in the main worktree (`.git-dir` does not contain `worktrees/`) → main-branch context: stage and commit the pending task changes directly on this branch, then report the commit hash, commit message, whether conflicts were resolved, and any remaining manual follow-up. Skip the stash/cherry-pick steps.
   - On a branch inside a linked worktree (`.git-dir` contains `worktrees/`) → treat it like the worktree context, using the current branch as `<base_ref>` if it is already the task's base branch, otherwise follow steps 1–9.

1. In the current task worktree, stage and create a commit for the pending task changes.
2. Find where `<base_ref>` is checked out:
   - Run `git worktree list --porcelain`.
   - If branch `<base_ref>` is checked out in path P, use that P.
   - If not checked out anywhere, use the current worktree as P by checking out `<base_ref>` there.
3. In P, verify the current branch is `<base_ref>`.
4. If P has uncommitted changes, stash them and record the new stash's SHA so you only ever pop the entry you created:
   - `git -C P stash push -u -m "wt-commit-pre-cherry-pick"`
   - `STASH_SHA=$(git -C P rev-parse stash@{0})`
5. Cherry-pick the task commit into P. If this fails because `.git/index.lock` exists, wait briefly for any active git process to finish. If the lock remains and no git process is active, treat the lock as stale, remove it, and retry.
6. If the cherry-pick conflicts, resolve carefully, preserving both the intended task changes and existing user edits, then `git -C P cherry-pick --continue`.
7. If step 4 created a stash entry, restore it with `git -C P stash apply "$STASH_SHA"`, then drop it:
   - `git stash pop` refuses a bare SHA — it only accepts reflog references like `stash@{0}`, so use `apply` with the recorded SHA.
   - Drop with `git -C P stash drop stash@{0}` only after verifying `git -C P rev-parse stash@{0}` still equals `$STASH_SHA`; if the top of the stack changed, stop and report instead of dropping.
8. If the stash apply conflicts, resolve them while preserving pre-existing user edits.
9. Report:
   - Final commit hash
   - Final commit message
   - Whether stash was used
   - Whether conflicts were resolved
   - Any remaining manual follow-up needed

## Notes

- Cherry-pick (rather than merge or rebase) is deliberate: it moves exactly one task commit and leaves unrelated base-worktree history untouched.
- The `-u` in the stash push is required so untracked files in the base worktree are not lost during the cherry-pick.
- Only pop a stash entry you created in step 4; never pop a pre-existing user stash.

From ansidev/skills, MIT.

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Sep 6, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from ansidev

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get wt-commit running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying wt-commit?

CallGet help
Cite this page

wt-commit skill. Agent Mart. https://agentmart.dev/skills/ansidev-wt-commit (last updated 2026-10-24)