DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to merge a finished worktree back to main in one command with Worktrunk

Squash, rebase, fast-forward merge and remove the worktree with wt merge.

Short answer: Run wt merge main from the worktree; then It generates a commit message, merges the commit to main and removes the worktree and branch in the background; For a PR workflow instead run wt step commit, then gh pr create. All steps.

Who it is forA developer finishing an agent's branch who wants it merged and cleaned up without several git commands.

The problemFinishing a worktree by hand means commit, rebase, merge, then remove the worktree and branch.

The outcomeThe change merged to main with a generated commit message and the worktree removed.

What you need first

  • git
  • Homebrew or Cargo to install
  • Shell integration via `wt config shell install` so commands can change directories
  • An agent such as Claude Code or Codex

Steps

  1. Run wt merge main from the worktree
  2. It generates a commit message, merges the commit to main and removes the worktree and branch in the background
  3. For a PR workflow instead run wt step commit, then gh pr create
  4. After the PR is merged run wt remove

Prompt for your agent

In the worktree for <branch>, run `wt merge main` and show me the output. If I prefer a PR, use `wt step commit`, `gh pr create` and later `wt remove`.

Caveat. Commit message generation relies on a configured LLM; see the LLM commit messages docs.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for max-sixty/worktrunk and "Merge a finished worktree back to main in one command"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer